Skip to content

Commit

Permalink
Merge pull request #31 from aradhakrishnanGFDL/30-explorecatalog
Browse files Browse the repository at this point in the history
30 explorecatalog
  • Loading branch information
ceblanton authored Aug 14, 2024
2 parents 4479694 + 763f862 commit e7d568d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
3 changes: 2 additions & 1 deletion catalogbuilder/cats/gfdl_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@
"grid_label",
"realm",
"member_id",
"chunk_freq"
"chunk_freq",
"time_range"
],
"aggregations": [
{
Expand Down
2 changes: 1 addition & 1 deletion catalogbuilder/intakebuilder/builderconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


output_path_template = ['NA','NA','source_id','NA','experiment_id','platform','custom_pp','realm','cell_methods','frequency','chunk_freq']
output_file_template = ['realm','temporal_subset','variable_id']
output_file_template = ['realm','time_range','variable_id']

#OUTPUT FILE INFO is currently passed as command-line argument.
#We will revisit adding a csvfile, jsonfile and logfile configuration to the builder configuration file in the future.
Expand Down
6 changes: 6 additions & 0 deletions catalogbuilder/scripts/dmget.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import os
#for simple dmget usage, just use this !dmget {file}
#use following to wrap the dmget call for each path in the catalog
def dmgetmagic(x):
cmd = 'dmget %s'% str(x)
return os.system(cmd)
28 changes: 28 additions & 0 deletions catalogbuilder/scripts/getdatasets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import intake_esm, intake, dmget
cat = "/home/a1r/github/noaa-gfdl/catalogs/c96L65_am5f7b10r0_amip30_0806.json"
col = intake.open_esm_datastore(cat)
print("Dataframe summary")
print("---------------------")
print(col.df)
#lets search
freq = "day"
cfname = "air_temperature"
esmcat = col.search(frequency = freq, standard_name = cfname)
print("Search results in:")
print("---------------------")
print(esmcat)
##dmget data
print("dmgetting")
print("---------------------")
dmstatus = esmcat.df["path"].apply(dmget.dmgetmagic)
print("dgmet status")
print("---------------------")
dmstatus = esmcat.df["path"].apply(dmget.dmgetmagic)
print(dmstatus)
print("Aggregating and creating a dictionary with dataset names as keys and the values as the xarray dataset object")
dset_dict = esmcat.to_dataset_dict(cdf_kwargs={'chunks': {'time':5}, 'decode_times': False})
print("print dataset keys/names")
print("---------------------")
for k in dset_dict.keys():
print(k)

0 comments on commit e7d568d

Please sign in to comment.