Skip to content

Commit

Permalink
Update path for extracted data, more subdirectories
Browse files Browse the repository at this point in the history
  • Loading branch information
natgeo-wong committed Oct 23, 2024
1 parent 1fb72ad commit a7a713d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/extract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ function extractprecip(

end

fnc = datadir("precipitation","$(schname)-$(expname)-$(runname).nc")
fol = datadir("precipitation","$(schname)","$(expname)")
fnc = joinpath(fol,"$(runname).nc")
if !isdir(fol); mkpath(fol) end
if isfile(fnc); rm(fnc,force=true) end

nds = NCDataset(fnc,"c",attrib = Dict(
Expand Down Expand Up @@ -101,7 +103,9 @@ function extractprecip(

end

fnc = datadir("precipitation","$(schname)-$(expname).nc")
fol = datadir("precipitation","$(schname)")
fnc = joinpath(fol,"$(expname).nc")
if !isdir(fol); mkpath(fol) end
if isfile(fnc); rm(fnc,force=true) end

nds = NCDataset(fnc,"c",attrib = Dict(
Expand Down Expand Up @@ -170,7 +174,9 @@ function extractwwtg(

end

fnc = datadir("wwtg","$(schname)-$(expname)-$(runname).nc")
fol = datadir("wwtg","$(schname)","$(expname)")
fnc = joinpath(fol,"$(runname).nc")
if !isdir(fol); mkpath(fol) end
if isfile(fnc); rm(fnc,force=true) end

nds = NCDataset(fnc,"c",attrib = Dict(
Expand Down Expand Up @@ -258,8 +264,9 @@ function extractgms(

end

mkpath(datadir("gms"))
fnc = datadir("gms","$(schname)-$(expname)-$(runname).nc")
fol = datadir("gms","$(schname)","$(expname)")
fnc = joinpath(fol,"$(runname).nc")
if !isdir(fol); mkpath(fol) end
if isfile(fnc); rm(fnc,force=true) end

nds = NCDataset(fnc,"c",attrib = Dict(
Expand Down Expand Up @@ -407,8 +414,9 @@ function extractmoisturemode(

end

mkpath(datadir("moisturemode"))
fnc = datadir("moisturemode","$(schname)-$(expname)-$(runname).nc")
fol = datadir("moisturemode","$(schname)","$(expname)")
fnc = joinpath(fol,"$(runname).nc")
if !isdir(fol); mkpath(fol) end
if isfile(fnc); rm(fnc,force=true) end

nds = NCDataset(fnc,"c",attrib = Dict(
Expand Down

0 comments on commit a7a713d

Please sign in to comment.