Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Model Execution When trunc is Greater Than or Equal to 600 #644

Open
rocroc2017 opened this issue Dec 17, 2024 · 8 comments
Open
Labels
bug 🐞 Something isn't working grid 🌐 Points on a sphere

Comments

@rocroc2017
Copy link
Contributor

Dear Dr. Milan,
When run the model with the following code. The model runs normally when trunc is less than or equal to 599. However, when trunc is greater than or equal to 600, the model throws an error and fails to execute.
Could you please help me ? Thank you in advance for your assistance.

using SpeedyWeather
spectral_grid = SpectralGrid(trunc=600, Grid=FullGaussianGrid)
model = PrimitiveWetModel(spectral_grid)
simulation = initialize!(model)
run!(simulation, period=Day(1))
@milankl
Copy link
Member

milankl commented Dec 17, 2024

Can you post the error?

@rocroc2017
Copy link
Contributor Author

rocroc2017 commented Dec 17, 2024

Can you post the error?

MethodError: no method matching isless(::Int64, ::Nothing)
The function `isless` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  isless(::Missing, ::Any)
   @ Base missing.jl:87
  isless(::Any, ::Missing)
   @ Base missing.jl:88
  isless(::Real, ::Union{StatsBase.PValue, StatsBase.TestStat})
   @ StatsBase C:\Users\roc\.julia\packages\StatsBase\xgoZ5\src\statmodels.jl:91
  ...


Stacktrace:
 [1] <(x::Int64, y::Nothing)
   @ Base .\operators.jl:353
 [2] grid_cell_average!(output::FullGaussianGrid{Float32}, input::FullClenshawGrid{UInt8})
   @ SpeedyWeather.RingGrids C:\Users\roc\.julia\packages\SpeedyWeather\pliqj\src\RingGrids\interpolation.jl:562
 [3] initialize!(land_sea_mask::LandSeaMask{Float32, FullGaussianGrid{Float32}}, model::PrimitiveWetModel{SpeedyWeather.DeviceSetup{CPU, DataType}, Geometry{Float32, FullGaussianGrid}, Earth{Float32}, EarthAtmosphere{Float32}, Coriolis{Float32}, Geopotential{Float32}, EarthOrography{Float32, FullGaussianGrid{Float32}}, AdiabaticConversion{Float32}, NoParticleAdvection, InitialConditions{ZonalWind, PressureOnOrography, JablonowskiTemperature, ConstantRelativeHumidity}, NoRandomProcess, LandSeaMask{Float32, FullGaussianGrid{Float32}}, SeasonalOceanClimatology{Float32, FullGaussianGrid{Float32}}, SeasonalLandTemperature{Float32, FullGaussianGrid{Float32}}, SolarZenith{Float32}, AlbedoClimatology{Float32, FullGaussianGrid{Float32}}, SeasonalSoilMoisture{Float32, FullGaussianGrid{Float32}}, VegetationClimatology{Float32, FullGaussianGrid{Float32}}, ClausiusClapeyron{Float32}, BulkRichardsonDrag{Float32}, NoTemperatureRelaxation, BulkRichardsonDiffusion{Float32}, SurfaceThermodynamicsConstant, SurfaceWind{Float32}, SurfaceHeatFlux{Float32}, SurfaceEvaporation{Float32}, ImplicitCondensation{Float32}, SimplifiedBettsMiller{Float32, NoSurfacePerturbation}, ZeroOpticalDepth{Float32}, NoShortwave, JeevanjeeRadiation{Float32}, StochasticallyPerturbedParameterizationTendencies{Float32, Vector{Float32}}, Leapfrog{Float32}, SpectralTransform{Float32, Array, Vector{Float32}, Vector{ComplexF32}, Vector{Int64}, Matrix{ComplexF32}, Array{ComplexF32, 3}, LowerTriangularMatrix{Float32}, LowerTriangularArray{Float32, 2, Matrix{Float32}}}, ImplicitPrimitiveEquation{Float32}, HyperDiffusion{Float32, Matrix{Float32}}, CenteredVerticalAdvection{Float32, 1}, ClipNegatives, NetCDFOutput{FullGaussianGrid{Float32}, FullGaussianArray{Float32, 2, Matrix{Float32}}, AnvilInterpolator{Float32, FullGaussianGrid}}, Feedback})
   @ SpeedyWeather C:\Users\roc\.julia\packages\SpeedyWeather\pliqj\src\physics\land_sea_mask.jl:95
 [4] initialize!(model::PrimitiveWetModel{SpeedyWeather.DeviceSetup{CPU, DataType}, Geometry{Float32, FullGaussianGrid}, Earth{Float32}, EarthAtmosphere{Float32}, Coriolis{Float32}, Geopotential{Float32}, EarthOrography{Float32, FullGaussianGrid{Float32}}, AdiabaticConversion{Float32}, NoParticleAdvection, InitialConditions{ZonalWind, PressureOnOrography, JablonowskiTemperature, ConstantRelativeHumidity}, NoRandomProcess, LandSeaMask{Float32, FullGaussianGrid{Float32}}, SeasonalOceanClimatology{Float32, FullGaussianGrid{Float32}}, SeasonalLandTemperature{Float32, FullGaussianGrid{Float32}}, SolarZenith{Float32}, AlbedoClimatology{Float32, FullGaussianGrid{Float32}}, SeasonalSoilMoisture{Float32, FullGaussianGrid{Float32}}, VegetationClimatology{Float32, FullGaussianGrid{Float32}}, ClausiusClapeyron{Float32}, BulkRichardsonDrag{Float32}, NoTemperatureRelaxation, BulkRichardsonDiffusion{Float32}, SurfaceThermodynamicsConstant, SurfaceWind{Float32}, SurfaceHeatFlux{Float32}, SurfaceEvaporation{Float32}, ImplicitCondensation{Float32}, SimplifiedBettsMiller{Float32, NoSurfacePerturbation}, ZeroOpticalDepth{Float32}, NoShortwave, JeevanjeeRadiation{Float32}, StochasticallyPerturbedParameterizationTendencies{Float32, Vector{Float32}}, Leapfrog{Float32}, SpectralTransform{Float32, Array, Vector{Float32}, Vector{ComplexF32}, Vector{Int64}, Matrix{ComplexF32}, Array{ComplexF32, 3}, LowerTriangularMatrix{Float32}, LowerTriangularArray{Float32, 2, Matrix{Float32}}}, ImplicitPrimitiveEquation{Float32}, HyperDiffusion{Float32, Matrix{Float32}}, CenteredVerticalAdvection{Float32, 1}, ClipNegatives, NetCDFOutput{FullGaussianGrid{Float32}, FullGaussianArray{Float32, 2, Matrix{Float32}}, AnvilInterpolator{Float32, FullGaussianGrid}}, Feedback}; time::DateTime)
   @ SpeedyWeather C:\Users\roc\.julia\packages\SpeedyWeather\pliqj\src\models\primitive_wet.jl:135
 [5] initialize!(model::PrimitiveWetModel{SpeedyWeather.DeviceSetup{CPU, DataType}, Geometry{Float32, FullGaussianGrid}, Earth{Float32}, EarthAtmosphere{Float32}, Coriolis{Float32}, Geopotential{Float32}, EarthOrography{Float32, FullGaussianGrid{Float32}}, AdiabaticConversion{Float32}, NoParticleAdvection, InitialConditions{ZonalWind, PressureOnOrography, JablonowskiTemperature, ConstantRelativeHumidity}, NoRandomProcess, LandSeaMask{Float32, FullGaussianGrid{Float32}}, SeasonalOceanClimatolog

@milankl
Copy link
Member

milankl commented Dec 17, 2024

```julia code ``` please

@milankl
Copy link
Member

milankl commented Dec 17, 2024

It's the grid_cell_average! function, that one is only called for the land sea mask, so with NoLandSeaMask you would bypass this. Could you check whether the "normal" resolutions trunc=255, 341, 511, 682, 1023, ... have the same problem?

@rocroc2017
Copy link
Contributor Author

It's the grid_cell_average! function, that one is only called for the land sea mask, so with NoLandSeaMask you would bypass this. Could you check whether the "normal" resolutions trunc=255, 341, 511, 682, 1023, ... have the same problem?

Thank you very much, I will try to use nolandseamask, tomorrow.

@SpeedyWeather SpeedyWeather deleted a comment from rocroc2017 Dec 17, 2024
@milankl milankl added bug 🐞 Something isn't working grid 🌐 Points on a sphere labels Dec 17, 2024
@rocroc2017
Copy link
Contributor Author

It's the grid_cell_average! function, that one is only called for the land sea mask, so with NoLandSeaMask you would bypass this. Could you check whether the "normal" resolutions trunc=255, 341, 511, 682, 1023, ... have the same problem?

511 is ok, but 682 and 1023 have the same problem

@rocroc2017
Copy link
Contributor Author

rocroc2017 commented Dec 18, 2024

It's the grid_cell_average! function, that one is only called for the land sea mask, so with NoLandSeaMask you would bypass this. Could you check whether the "normal" resolutions trunc=255, 341, 511, 682, 1023, ... have the same problem?

Dear Dr. Milan
I try to follow your suggestion to use NoLandSeaMask in two ways:

  1. set land_sea_mask=0 or 1, the same problem as yesterday.
using SpeedyWeather
spectral_grid = SpectralGrid(trunc=1023, Grid=FullGaussianGrid)
model = PrimitiveWetModel(spectral_grid)
set!(model, land_sea_mask=0) 
simulation = initialize!(model)

error

MethodError: no method matching isless(::Int64, ::Nothing)
The function `isless` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  isless(::Missing, ::Any)
   @ Base missing.jl:87
  isless(::Any, ::Missing)
   @ Base missing.jl:88
  isless(::Real, ::Union{StatsBase.PValue, StatsBase.TestStat})
   @ StatsBase [C:\Users\roc\.julia\packages\StatsBase\xgoZ5\src\statmodels.jl:91](file:///C:/Users/roc/.julia/packages/StatsBase/xgoZ5/src/statmodels.jl#line=90)
  ...


Stacktrace:
 [1] <(x::Int64, y::Nothing)
   @ Base [.\operators.jl:353](http://localhost:8888/lab/tree/speedyweather/operators.jl#line=352)
 [2] grid_cell_average!(output::FullGaussianGrid{Float32}, input::FullClenshawGrid{UInt8})
   @ SpeedyWeather.RingGrids [C:\Users\roc\.julia\packages\SpeedyWeather\pliqj\src\RingGrids\interpolation.jl:562](file:///C:/Users/roc/.julia/packages/SpeedyWeather/pliqj/src/RingGrids/interpolation.jl#line=561)
 [3] initialize!(land_sea_mask::LandSeaMask{Float32, FullGaussianGrid{Float32}}, model::PrimitiveWetModel{SpeedyWeather.DeviceSetup{CPU, DataType}, Geometry{Float32, FullGaussianGrid}, Earth{Float32}, EarthAtmosphere{Float32}, Coriolis{Float32}, Geopotential{Float32}, EarthOrography{Float32, FullGaussianGrid{Float32}}, AdiabaticConversion{Float32}, NoParticleAdvection, InitialConditions{ZonalWind, PressureOnOrography, JablonowskiTemperature, ConstantRelativeHumidity}, NoRandomProcess, LandSeaMask{Float32, FullGaussianGrid{Float32}}, SeasonalOceanClimatology{Float32, FullGaussianGrid{Float32}}, SeasonalLandTemperature{Float32, FullGaussianGrid{Float32}}, SolarZenith{Float32}, AlbedoClimatology{Float32, FullGaussianGrid{Float32}}, SeasonalSoilMoisture{Float32, FullGaussianGrid{Float32}}, VegetationClimatology{Float32, FullGaussianGrid{Float32}}, ClausiusClapeyron{Float32}, BulkRichardsonDrag{Float32}, NoTemperatureRelaxation, BulkRichardsonDiffusion{Float32}, SurfaceThermodynamicsConstant, SurfaceWind{Float32}, SurfaceHeatFlux{Float32}, SurfaceEvaporation{Float32}, ImplicitCondensation{Float32}, SimplifiedBettsMiller{Float32, NoSurfacePerturbation}, ZeroOpticalDepth{Float32}, NoShortwave, JeevanjeeRadiation{Float32}, StochasticallyPerturbedParameterizationTendencies{Float32, Vector{Float32}}, Leapfrog{Float32}, SpectralTransform{Float32, Array, Vector{Float32}, Vector{ComplexF32}, Vector{Int64}, Matrix{ComplexF32}, Array{ComplexF32, 3}, LowerTriangularMatrix{Float32}, LowerTriangularArray{Float32, 2, Matrix{Float32}}}, ImplicitPrimitiveEquation{Float32}, HyperDiffusion{Float32, Matrix{Float32}}, CenteredVerticalAdvection{Float32, 1}, ClipNegatives, NetCDFOutput{FullGaussianGrid{Float32}, FullGaussianArray{Float32, 2, Matrix{Float32}}, AnvilInterpolator{Float32, FullGaussianGrid}}, Feedback})
   @ SpeedyWeather [C:\Users\roc\.julia\packages\SpeedyWeather\pliqj\src\physics\land_sea_mask.jl:95](file:///C:/Users/roc/.julia/packages/SpeedyWeather/pliqj/src/physics/land_sea_mask.jl#line=94)
 [4] initialize!(model::PrimitiveWetModel{SpeedyWeather.DeviceSetup{CPU, DataType}, Geometry{Float32, FullGaussianGrid}, Earth{Float32}, EarthAtmosphere{Float32}, Coriolis{Float32}, Geopotential{Float32}, EarthOrography{Float32, FullGaussianGrid{Float32}}, AdiabaticConversion{Float32}, NoParticleAdvection, InitialConditions{ZonalWind, PressureOnOrography, JablonowskiTemperature, ConstantRelativeHumidity}, NoRandomProcess, LandSeaMask{Float32, FullGaussianGrid{Float32}}, SeasonalOceanClimatology{Float32, FullGaussianGrid{Float32}}, SeasonalLandTemperature{Float32, FullGaussianGrid{Float32}}, SolarZenith{Float32}, AlbedoClimatology{Float32, FullGaussianGrid{Float32}}, SeasonalSoilMoisture{Float32, FullGaussianGrid{Float32}}, VegetationClimatology{Float32, FullGaussianGrid{Float32}}, ClausiusClapeyron{Float32}, BulkRichardsonDrag{Float32}, NoTemperatureRelaxation, BulkRichardsonDiffusion{Float32}, SurfaceThermodynamicsConstant, SurfaceWind{Float32}, SurfaceHeatFlux{Float32}, SurfaceEvaporation{Float32}, ImplicitCondensation{Float32}, SimplifiedBettsMiller{Float32, NoSurfacePerturbation}, ZeroOpticalDepth{Float32}, NoShortwave, JeevanjeeRadiation{Float32}, StochasticallyPerturbedParameterizationTendencies{Float32, Vector{Float32}}, Leapfrog{Float32}, SpectralTransform{Float32, Array, Vector{Float32}, Vector{ComplexF32}, Vector{Int64}, Matrix{ComplexF32}, Array{ComplexF32, 3}, LowerTriangularMatrix{Float32}, LowerTriangularArray{Float32, 2, Matrix{Float32}}}, ImplicitPrimitiveEquation{Float32}, HyperDiffusion{Float32, Matrix{Float32}}, CenteredVerticalAdvection{Float32, 1}, ClipNegatives, NetCDFOutput{FullGaussianGrid{Float32}, FullGaussianArray{Float32, 2, Matrix{Float32}}, AnvilInterpolator{Float32, FullGaussianGrid}}, Feedback}; time::DateTime)
   @ SpeedyWeather [C:\Users\roc\.julia\packages\SpeedyWeather\pliqj\src\models\primitive_wet.jl:135](file:///C:/Users/roc/.julia/packages/SpeedyWeather/pliqj/src/models/primitive_wet.jl#line=134)
 [5] initialize!(model::PrimitiveWetModel{SpeedyWeather.DeviceSetup{CPU, DataType}, Geometry{Float32, FullGaussianGrid}, Earth{Float32}, EarthAtmosphere{Float32}, Coriolis{Float32}, Geopotential{Float32}, EarthOrography{Float32, FullGaussianGrid{Float32}}, AdiabaticConversion{Float32}, NoParticleAdvection, InitialConditions{ZonalWind, PressureOnOrography, JablonowskiTemperature, ConstantRelativeHumidity}, NoRandomProcess, LandSeaMask{Float32, FullGaussianGrid{Float32}}, SeasonalOceanClimatology{Float32, FullGaussianGrid{Float32}}, SeasonalLandTemperature{Float32, FullGaussianGrid{Float32}}, SolarZenith{Float32}, AlbedoClimatology{Float32, FullGaussianGrid{Float32}}, SeasonalSoilMoisture{Float32, FullGaussianGrid{Float32}}, VegetationClimatology{Float32, FullGaussianGrid{Float32}}, ClausiusClapeyron{Float32}, BulkRichardsonDrag{Float32}, NoTemperatureRelaxation, BulkRichardsonDiffusion{Float32}, SurfaceThermodynamicsConstant, SurfaceWind{Float32}, SurfaceHeatFlux{Float32}, SurfaceEvaporation{Float32}, ImplicitCondensation{Float32}, SimplifiedBettsMiller{Float32, NoSurfacePerturbation}, ZeroOpticalDepth{Float32}, NoShortwave, JeevanjeeRadiation{Float32}, StochasticallyPerturbedParameterizationTendencies{Float32, Vector{Float32}}, Leapfrog{Float32}, SpectralTransform{Float32, Array, Vector{Float32}, Vector{ComplexF32}, Vector{Int64}, Matrix{ComplexF32}, Array{ComplexF32, 3}, LowerTriangularMatrix{Float32}, LowerTriangularArray{Float32, 2, Matrix{Float32}}}, ImplicitPrimitiveEquation{Float32}, HyperDiffusion{Float32, Matrix{Float32}}, CenteredVerticalAdvection{Float32, 1}, ClipNegatives, NetCDFOutput{FullGaussianGrid{Float32}, FullGaussianArray{Float32, 2, Matrix{Float32}}, AnvilInterpolator{Float32, FullGaussianGrid}}, Feedback})
   @ SpeedyWeather [C:\Users\roc\.julia\packages\SpeedyWeather\pliqj\src\models\primitive_wet.jl:120](file:///C:/Users/roc/.julia/packages/SpeedyWeather/pliqj/src/models/primitive_wet.jl#line=119)
 [6] top-level scope
   @ In[49]:5
  1. set land_sea_mask = NoLandSeaMask in model , it is not an option
using SpeedyWeather
spectral_grid = SpectralGrid(trunc=1023, Grid=FullGaussianGrid)
model = PrimitiveWetModel(spectral_grid, land_sea_mask = NoLandSeaMask)

error

UndefVarError: `NoLandSeaMask` not defined in `Main`
Suggestion: check for spelling errors or missing imports.

Stacktrace:
 [1] top-level scope
   @ In[50]:3

@maximilian-gelbrecht
Copy link
Member

maximilian-gelbrecht commented Dec 18, 2024

You can use

model = PrimitiveWetModel(spectral_grid, land_sea_mask = AquaPlanetMask(spectral_grid))

instead. This defines an aqua planet, so no land sea mask.

trunc=1023 is almost but not quite at the resolution of the land sea mask that we store in our input files / defaults. There seems to be some issue interpolating/avering this default land sea mask onto grids of very high resolutions. We'll probably fix that very soon. In the time being you can use the AquaPlanetMask or provide a NetCDF file with a land-sea mask in an even higher resolution to LandSeaMask.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working grid 🌐 Points on a sphere
Projects
None yet
Development

No branches or pull requests

3 participants