Skip to content

Commit

Permalink
Save LandSea as Geopotential, but when loading into struct, convert t…
Browse files Browse the repository at this point in the history
…o height
  • Loading branch information
natgeo-wong committed Nov 30, 2023
1 parent fa26fe0 commit c8785fc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/landsea/landsea.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end

function getLandSea(
e5ds :: ERA5Dataset,
ereg :: ERA5Region = ERA5Region(GeoRegion("GLB"));
ereg :: ERA5Region = ERA5Region("GLB");
save :: Bool = true,
returnlsd :: Bool = true,
smooth :: Bool = false,
Expand Down Expand Up @@ -63,18 +63,18 @@ function getLandSea(
else; mask = ones(Int,nlon,nlat)
end

if isGeoRegion(ereg.ID,throw=false) && save
if save
saveLandSea(
e5ds, ereg, ggrd.lon, ggrd.lat, rlsm, roro, Int16.(mask),
smooth, σlon, σlat
)
else
return LandSea{FT}(ggrd.lon,ggrd.lat,rlsm,roro,Int16.(mask))
return LandSea{FT}(ggrd.lon,ggrd.lat,rlsm,roro/9.80665,Int16.(mask))
end

end

if isGeoRegion(ereg.ID,throw=false) && returnlsd
if returnlsd

lds = NCDataset(lsmfnc)
lon = lds["longitude"][:]
Expand All @@ -86,7 +86,7 @@ function getLandSea(

@info "$(modulelog()) - Retrieving the regional ERA5 Land-Sea mask for the \"$(ereg.ID)\" ERA5Region ..."

return LandSea{FT}(lon,lat,lsm,oro,msk)
return LandSea{FT}(lon,lat,lsm,oro/9.80665,msk)

else

Expand Down Expand Up @@ -118,7 +118,7 @@ function downloadLandSea(
lon = tds["longitude"][:]; nlon = length(lon)
lat = tds["latitude"][:]; nlat = length(lat)
lsm = tds["lsm"][:,:,1] * 1
oro = tds["z"][:,:,1] / 9.80665
oro = tds["z"][:,:,1] * 1
msk = ones(Int16,nlon,nlat)
close(tds)

Expand Down

0 comments on commit c8785fc

Please sign in to comment.