Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

30 explorecatalog #31

Merged
merged 3 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions catalogbuilder/intakebuilder/builderconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
headerlist = ["activity_id", "institution_id", "source_id", "experiment_id",
"frequency", "realm", "table_id",
"member_id", "grid_label", "variable_id",
"temporal_subset", "chunk_freq","grid_label","platform","dimensions","cell_methods","path"]
"time_range", "chunk_freq","grid_label","platform","dimensions","cell_methods","path"]

#what kind of directory structure to expect?
#For a directory structure like /archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp
Expand All @@ -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)