Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Use different data products w/ the CrocoDash Data Access Module

This module can be used with case.configure_forcings to find different ways to access raw data from data sources. Just supply data product name and function name in the following manner:

case.configure_forcing(...other_arguments..., 
product_name = "product_name", 
function_name = "function_name")

Available products and functions can be found in the documentation and in the raw_data_access helper functions shown below. A full list of available functions & products can be accessed in the same documentation.

from CrocoDash.raw_data_access import driver
from CrocoDash.raw_data_access import config as tb
pfr_obj = driver.ProductFunctionRegistry()
pfr_obj.load_functions()
pfr_obj.functions
{'GLORYS': {'get_glorys_data_from_cds_api': <function CrocoDash.data_access.glorys.get_glorys_data_from_cds_api(dates, lat_min, lat_max, lon_min, lon_max, output_dir=None, output_file=None)>, 'get_glorys_data_from_rda': <function CrocoDash.data_access.glorys.get_glorys_data_from_rda(dates: list, lat_min, lat_max, lon_min, lon_max, output_dir=PosixPath('.'), output_file='raw_glorys.nc') -> xarray.core.dataset.Dataset>, 'get_glorys_data_script_for_cli': <function CrocoDash.data_access.glorys.get_glorys_data_script_for_cli(dates: tuple, lat_min, lat_max, lon_min, lon_max, output_dir, output_file) -> None>}}
tb.list_products()
['GLORYS', 'GEBCO', 'TPXO', 'GLOFAS', 'CESM Inputdata Repo (Bathymetry)', 'CESM Inputdata Repo (Grids)']
tb.list_functions("GLORYS")
['get_glorys_data_from_cds_api', 'get_glorys_data_from_rda', 'get_glorys_data_script_for_cli']
tb.type_of_function("GLORYS","get_glorys_data_from_cds_api")
'PYTHON'
case.configure_forcing(date_range = ["2020-01-01 00:00:00", "2020-01-09 00:00:00"], 
                       product_name = "product_name", 
                       function_name = "function_name")

Accessing non-forcing raw data

Apart from accessing forcing products through case.configure_forcings(), we can access products like GEBCO, SEAWIFS, GLOFAS, etc.. through importing the raw data access module, like below.

# Import the specific module (which can be found by looking at the API Documentation: https://crocodile-cesm.github.io/CrocoDash/api-docs/CrocoDash.raw_data_access.datasets.html)
from CrocoDash.raw_data_access.datasets import glofas as gl

# Then call the function
gl.get_processed_global_glofas_script_for_cli(output_dir=tmp_path, output_file="glofas_processed_data.nc")