-
Notifications
You must be signed in to change notification settings - Fork 33
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
Surface fluxes of heat, moisture and momentum: Land and ocean seasonal climatology #399
Conversation
Surface humidity 1 day after starting from a dry atmosphere, fluxes currently not based on skin temperatures, vegetation ignored (availability = 0.2 everywhere) 10 days in 30 days in still not high enough to precipitate. |
using NCDatasets, Dates, BitInformation
ds = NCDataset("land.nc")
ds2 = NCDataset("land_surface_temperature.nc","c")
nx, ny, nt = ds.dim["lon"], ds.dim["lat"], ds.dim["time"]
defDim(ds2,"lon",nx)
defDim(ds2,"lat",ny)
defDim(ds2,"time",nt)
t0 = Dates.DateTime(1981,1,1)
lon = defVar(ds2,"lon",Float32,("lon",),attrib=Dict("units"=>"degrees_east","long_name"=>"longitude"))
lat = defVar(ds2,"lat",Float32,("lat",),attrib=Dict("units"=>"degrees_north","long_name"=>"latitude"))
time = defVar(ds2,"time",Int64,("time",),attrib=Dict("units"=>"hours since 1981-1-1 00:00:00",
"standard_name"=>"time",
"calendar"=>"gregorian"))
lon[:] = ds["lon"][:]
lat[:] = ds["lat"][:]
for t in 1:nt
time[t] = Dates.Hour.(ds["time"][t] - t0).value
end
lst = defVar(ds2,"lst",Float32,("lon","lat","time"),
attrib=Dict("long_name"=>"land surface temperature",
"units"=>"K","_FillValue"=>ds["stl"][1,1,1]),
deflatelevel=9,shuffle=true)
keepbits = 11
lst[:] = round(ds["stl"][:],keepbits)
close(ds2) |
Last commit brings the model initialisation time down to 0.1-0.2s (was 2-4s). Before: (no ocean or land initialization, which is an interpolation for every month) julia> @time simulation = initialize!(model)
1.691842 seconds (437.42 k allocations: 108.633 MiB, 1.29% gc time)
SpeedyWeather.Simulation{PrimitiveWetModel{Float32, SpeedyWeather.CPUDevice}}
├ PrimitiveWetModel{Float32, SpeedyWeather.CPUDevice}
├ PrognosticVariables{Float32, OctahedralGaussianGrid{Float32}, PrimitiveWetModel{Float32, SpeedyWeather.CPUDevice}}
└ DiagnosticVariables{Float32, OctahedralGaussianGrid{Float32}, PrimitiveWet} After: (with ocean, land and orography) julia> @time simulation = initialize!(model)
0.137597 seconds (641.46 k allocations: 61.707 MiB)
Main.SpeedyWeather.Simulation{PrimitiveWetModel{Float32, Main.SpeedyWeather.CPUDevice}}
├ PrimitiveWetModel{Float32, Main.SpeedyWeather.CPUDevice}
├ PrognosticVariables{Float32, OctahedralGaussianGrid{Float32}, PrimitiveWet}
└ DiagnosticVariables{Float32, OctahedralGaussianGrid{Float32}, PrimitiveWet} Orography had an expensive large spectal transform (interpolation now), ocean and land read individual values from netcdf (slow, now in batch). |
This implements surface fluxes of heat, moisture and momentum following Fortran SPEEDY but with shortcuts (no skin temperature calculation for now). Land and ocean temperatures are seasonal climatologies updated every 3 days.