Skip to content

Commit

Permalink
Merge pull request #130 from gaelforget/v0p3p9d
Browse files Browse the repository at this point in the history
V0p3p9d
  • Loading branch information
gaelforget authored Aug 20, 2024
2 parents 74dff6f + 9a5d702 commit b546166
Show file tree
Hide file tree
Showing 7 changed files with 830 additions and 455 deletions.
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[deps]
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
Climatology = "9e9a4d37-2d2e-41e3-8b85-f7978328d9c7"
DataDeps = "124859b0-ceae-595e-8997-d05f6a7a8dfe"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
GeoJSON = "61d90e0f-e114-555e-ac52-39dfb47a3ef9"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
OceanStateEstimation = "891f6deb-a4f5-4bc5-a2e3-1e8f649cdd2c"
PlutoSliderServer = "2fc8631c-6f24-4c5b-bca7-cbb509c42db4"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
Shapefile = "8e980c4a-a4fe-5da2-b3a7-4b4b0353a2f4"
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ using Documenter, PlutoSliderServer, MeshArrays, DataDeps, CairoMakie

ENV["DATADEPS_ALWAYS_ACCEPT"]=true

import OceanStateEstimation
OceanStateEstimation.get_ecco_velocity_if_needed()
import Climatology
Climatology.get_ecco_velocity_if_needed()

MeshArrays.GRID_LL360_download()
MeshArrays.GRID_LLC90_download()
Expand Down
42 changes: 38 additions & 4 deletions examples/ERA5/ERA5_module.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ function ave3h(a,buffer2d,buff2d,y,d,r,rec0; path="ERA5/", variable=1)
a.=a/3
end

function loop_over_years(variable=1,path="ERA5/")
y0=1941
ny=83
ndmax=366
function loop_over_years(variable=1;path="ERA5/",y0=1941,ny=83,ndmax=366)

γ=GridSpec("LatLonCap",MeshArrays.GRID_LLC90)
Γ=GridLoad(γ)
Expand Down Expand Up @@ -163,5 +160,42 @@ function loop_over_years(variable=1,path="ERA5/")
S
end

##

function loop_over_years_spfh(; path="ERA5/ERA5_llc90/",y0=1941,ny=83,ndmax=366)

γ=GridSpec("LatLonCap",MeshArrays.GRID_LLC90)
spfh=zeros(Float32,γ.ioSize...)
d2m=zeros(Float32,γ.ioSize...)
pres=zeros(Float32,γ.ioSize...)

for y in y0.+(0:ny-1)
nd=Day(DateTime(y+1,1)-DateTime(y,1)).value

fil_out=joinpath(pth_out,"llc90_ERA5_spfh2m_$y")
fil_d2m=joinpath(pth_out,"llc90_ERA5_d2m_$y")
fil_pres=joinpath(pth_out,"llc90_ERA5_pres_$y")

g_out=FortranFiles.FortranFile(fil_out,"w",access="direct",recl=90*1170*4,convert="big-endian")
g_d2m=FortranFiles.FortranFile(fil_d2m,"r",access="direct",recl=90*1170*4,convert="big-endian")
g_pres=FortranFiles.FortranFile(fil_pres,"r",access="direct",recl=90*1170*4,convert="big-endian")

nt=8*min(Dates.Day(DateTime(y+1,1,1)-DateTime(y,1,1)).value,ndmax)

for t in 1:nt
FortranFiles.read(g_d2m,rec=t,d2m)
FortranFiles.read(g_pres,rec=t,pres)
[spfh[i]=qsat(pres[i],E(d2m[i])) for i in eachindex(IndexCartesian(),spfh)]
FortranFiles.write(g_out,rec=t,Float32.(spfh))
end

close(g_out)
close(g_d2m)
close(g_pres)
end
end

##

end #module ERA5interp

Loading

0 comments on commit b546166

Please sign in to comment.