Skip to content

Commit

Permalink
the other columns for static seem ok for the first pass
Browse files Browse the repository at this point in the history
  • Loading branch information
aradhakrishnanGFDL committed Oct 22, 2024
1 parent 76e34a2 commit 5b94458
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
10 changes: 8 additions & 2 deletions catalogbuilder/intakebuilder/getinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ def getInfoFromGFDLFilename(filename,dictInfo,logger,configyaml):
if( "static" in filename ):
## For static we handle this differently . The GFDL PP expected pattern is atmos.static.nc
#TODO figure out better ways to set this and use fixed for frequency and table_id
output_file_template = ['realm','frequency']
output_file_template = ['realm']
dictInfo["variable_id"] = "fixed" #TODO verify if variable_id is a key
dictInfo["frequency"] = "fixed"
dictInfo["table_id"] = "fixed"
##
nlen = len(output_file_template)
for i in range(nlen-1,-1,-1): #nlen = 3
Expand All @@ -132,11 +134,12 @@ def getInfoFromGFDLFilename(filename,dictInfo,logger,configyaml):
print(dictInfo)
return dictInfo

def getInfoFromGFDLDRS(dirpath,projectdir,dictInfo,configyaml):
def getInfoFromGFDLDRS(dirpath,projectdir,dictInfo,configyaml,variable_id):
'''
Returns info from project directory and the DRS path to the file
:param dirpath:
:param drsstructure:
:param variable_id to check for static
:return:
'''
# we need thise dict keys "project", "institute", "model", "experiment_id",
Expand All @@ -159,6 +162,9 @@ def getInfoFromGFDLDRS(dirpath,projectdir,dictInfo,configyaml):
output_path_template = builderconfig.output_path_template
except:
sys.exit("No output_path_template found in builderconfig.py. Check configuration.")
#If variable_id is fixed, it's a GFDL PP static dataset and the output path template in config is aligned only up to a particular directory structure as this does not have the ts and frequency or time chunks
if(variable_id == "fixed"):
output_path_template = output_path_template[:-3 or None]
nlen = len(output_path_template)
for i in range(nlen-1,0,-1):
try:
Expand Down
7 changes: 6 additions & 1 deletion catalogbuilder/intakebuilder/gfdlcrawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ def crawlLocal(projectdir, dictFilter,dictFilterIgnore,logger,configyaml,slow):
else:
dictInfo = getinfo.getInfoFromGFDLFilename(filename,dictInfo, logger,configyaml)
print("1. ", dictInfo)
dictInfo = getinfo.getInfoFromGFDLDRS(dirpath, projectdir, dictInfo,configyaml)
if "variable_id" in dictInfo.keys():
if dictInfo["variable_id"] is not None:
variable_id = dictInfo["variable_id"]
else:
variable_id = ""
dictInfo = getinfo.getInfoFromGFDLDRS(dirpath, projectdir, dictInfo,configyaml,variable_id)
print("2.", dictInfo)
list_bad_modellabel = ["","piControl","land-hist","piClim-SO2","abrupt-4xCO2","hist-piAer","hist-piNTCF","piClim-ghg","piClim-OC","hist-GHG","piClim-BC","1pctCO2"]
list_bad_chunklabel = ['DO_NOT_USE']
Expand Down
4 changes: 2 additions & 2 deletions configs/config-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ headerlist: ["activity_id", "institution_id", "source_id", "experiment_id",
#this is a valid value in headerlist as well.
#The fourth directory is am5f3b1r0 which does not map to an existing header value. So we simply NA in output_path_template
#for the fourth value.

output_path_template: ['NA','NA','source_id','NA','experiment_id','platform','custom_pp','realm','cell_methods','frequency','chunk_freq']
#/archive/a1r/fre/FMS2024.02_OM5_20240724/CM4.5v01_om5b06_piC_noBLING/gfdl.ncrc5-intel23-prod-openmp/pp/ocean_monthly/ocean_monthly.static.nc
output_path_template: ['NA','NA','NA','source_id','experiment_id','platform','custom_pp','realm','cell_methods','frequency','chunk_freq']

output_file_template: ['realm','time_range','variable_id']

Expand Down

0 comments on commit 5b94458

Please sign in to comment.