From a7a713d06c8c446b8db00b14c15c2192aa8b0a67 Mon Sep 17 00:00:00 2001 From: Nathanael Wong Date: Tue, 22 Oct 2024 20:27:47 -0400 Subject: [PATCH] Update path for extracted data, more subdirectories --- src/extract.jl | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/extract.jl b/src/extract.jl index 24e92e8..d13ef9c 100644 --- a/src/extract.jl +++ b/src/extract.jl @@ -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( @@ -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( @@ -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( @@ -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( @@ -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(