Skip to content

Commit 566e1c3

Browse files
committed
Reordering some function arguments
1 parent 2c6e287 commit 566e1c3

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/landsea/landsea.jl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -196,22 +196,22 @@ function saveLandSea(
196196
end
197197

198198
function getLandSea(
199-
efol :: AbstractString,
200-
ereg :: ERA5Region = ERA5Region(GeoRegion("GLB"));
199+
ereg :: ERA5Region = ERA5Region(GeoRegion("GLB"));
200+
eroot :: AbstractString = homedir(),
201201
returnlsd = true,
202202
FT = Float32
203203
)
204204

205-
lsmfnc = joinpath(efol,"emask-$(ereg.gstr).nc")
205+
lsmfnc = joinpath(eroot,"emask-$(ereg.gstr).nc")
206206

207207
if !isfile(lsmfnc)
208208

209209
@info "$(modulelog()) - The ERA5 Land-Sea mask dataset for the \"$(ereg.geoID)\" ERA5Region is not available, extracting from Global ERA5 Land-Sea mask dataset ..."
210210

211-
glbfnc = joinpath(efol,"emask-GLBx$(@sprintf("%.2f",ereg.gres)).nc")
211+
glbfnc = joinpath(eroot,"emask-GLBx$(@sprintf("%.2f",ereg.gres)).nc")
212212
if !isfile(glbfnc)
213213
@info "$(modulelog()) - The Global ERA5 Land-Sea mask dataset for the \"$(ereg.geoID)\" ERA5Region is not available, downloading from the Climate Data Store ..."
214-
downloadLandSea(efol,ereg)
214+
downloadLandSea(eroot,ereg)
215215
end
216216

217217
gds = NCDataset(glbfnc)
@@ -244,7 +244,7 @@ function getLandSea(
244244
end
245245
end
246246

247-
saveLandSea(efol,ereg,rinfo.glon,rinfo.glat,rlsm,roro,Int16.(mask))
247+
saveLandSea(eroot,ereg,rinfo.glon,rinfo.glat,rlsm,roro,Int16.(mask))
248248

249249
end
250250

@@ -271,11 +271,11 @@ function getLandSea(
271271
end
272272

273273
function downloadLandSea(
274-
efol :: AbstractString,
275-
ereg :: ERA5Region
274+
eroot :: AbstractString,
275+
ereg :: ERA5Region
276276
)
277277

278-
tmpfnc = joinpath(efol,"tmp.nc")
278+
tmpfnc = joinpath(eroot,"tmp.nc")
279279
retrieve(
280280
"reanalysis-era5-single-levels-monthly-means", Dict(
281281
"product_type" => "monthly_averaged_reanalysis",
@@ -297,7 +297,7 @@ function downloadLandSea(
297297
close(tds)
298298

299299
saveLandSea(
300-
efol,ERA5Region(GeoRegion("GLB"),gres=ereg.gres),
300+
eroot,ERA5Region(GeoRegion("GLB"),gres=ereg.gres),
301301
lon,lat,lsm,oro,msk
302302
)
303303

@@ -306,16 +306,16 @@ function downloadLandSea(
306306
end
307307

308308
function saveLandSea(
309-
efol :: AbstractString,
310-
ereg :: ERA5Region,
311-
lon :: Vector{<:Real},
312-
lat :: Vector{<:Real},
313-
lsm :: Array{<:Real,2},
314-
oro :: Array{<:Real,2},
315-
mask :: Array{Int16,2},
309+
eroot :: AbstractString,
310+
ereg :: ERA5Region,
311+
lon :: Vector{<:Real},
312+
lat :: Vector{<:Real},
313+
lsm :: Array{<:Real,2},
314+
oro :: Array{<:Real,2},
315+
mask :: Array{Int16,2},
316316
)
317317

318-
fnc = joinpath(efol,"emask-$(ereg.gstr).nc")
318+
fnc = joinpath(eroot,"emask-$(ereg.gstr).nc")
319319
if isfile(fnc)
320320
rm(fnc,force=true)
321321
end

0 commit comments

Comments
 (0)