CrocoDash.raw_data_access package#
Subpackages#
- CrocoDash.raw_data_access.datasets package
- Submodules
- CrocoDash.raw_data_access.datasets.cesm_ocean_output module
CESM_MOM_OUTPUTCESM_MOM_OUTPUT.boundary_fill_methodCESM_MOM_OUTPUT.calendarCESM_MOM_OUTPUT.depth_coordCESM_MOM_OUTPUT.descriptionCESM_MOM_OUTPUT.eta_var_nameCESM_MOM_OUTPUT.get_mom6_output_data()CESM_MOM_OUTPUT.get_mom6_single_variable_data()CESM_MOM_OUTPUT.linkCESM_MOM_OUTPUT.loggerCESM_MOM_OUTPUT.product_nameCESM_MOM_OUTPUT.time_unitsCESM_MOM_OUTPUT.time_var_nameCESM_MOM_OUTPUT.tracer_lat_coordCESM_MOM_OUTPUT.tracer_lon_coordCESM_MOM_OUTPUT.tracer_var_namesCESM_MOM_OUTPUT.tracer_x_coordCESM_MOM_OUTPUT.tracer_y_coordCESM_MOM_OUTPUT.u_lat_coordCESM_MOM_OUTPUT.u_lon_coordCESM_MOM_OUTPUT.u_var_nameCESM_MOM_OUTPUT.u_x_coordCESM_MOM_OUTPUT.u_y_coordCESM_MOM_OUTPUT.v_lat_coordCESM_MOM_OUTPUT.v_lon_coordCESM_MOM_OUTPUT.v_var_nameCESM_MOM_OUTPUT.v_x_coordCESM_MOM_OUTPUT.v_y_coord
CESM_POP_OUTPUTCESM_POP_OUTPUT.boundary_fill_methodCESM_POP_OUTPUT.calendarCESM_POP_OUTPUT.delimiterCESM_POP_OUTPUT.depth_coordCESM_POP_OUTPUT.descriptionCESM_POP_OUTPUT.eta_var_nameCESM_POP_OUTPUT.get_cesm_single_variable_data()CESM_POP_OUTPUT.linkCESM_POP_OUTPUT.loggerCESM_POP_OUTPUT.marbl_var_namesCESM_POP_OUTPUT.product_nameCESM_POP_OUTPUT.time_unitsCESM_POP_OUTPUT.time_var_nameCESM_POP_OUTPUT.tracer_lat_coordCESM_POP_OUTPUT.tracer_lon_coordCESM_POP_OUTPUT.tracer_var_namesCESM_POP_OUTPUT.tracer_x_coordCESM_POP_OUTPUT.tracer_y_coordCESM_POP_OUTPUT.u_lat_coordCESM_POP_OUTPUT.u_lon_coordCESM_POP_OUTPUT.u_var_nameCESM_POP_OUTPUT.u_x_coordCESM_POP_OUTPUT.u_y_coordCESM_POP_OUTPUT.v_lat_coordCESM_POP_OUTPUT.v_lon_coordCESM_POP_OUTPUT.v_var_nameCESM_POP_OUTPUT.v_x_coordCESM_POP_OUTPUT.v_y_coordCESM_POP_OUTPUT.z_unit_conversion
bbox_mask()convert_cftime_to_numeric()drop_extra_cftime_vars()first_value()get_date_range_from_filename()parse_dataset()read_single_variable_tseries_data()subset_dataset()subtract_month()validate_dataset_path()
- CrocoDash.raw_data_access.datasets.cesm_ww3_jra module
- CrocoDash.raw_data_access.datasets.cice_output module
CICE_RESTARTCICE_RESTART.calendarCICE_RESTART.depth_coordCICE_RESTART.descriptionCICE_RESTART.get_cice_restart_subset()CICE_RESTART.linkCICE_RESTART.loggerCICE_RESTART.product_nameCICE_RESTART.time_unitsCICE_RESTART.time_var_nameCICE_RESTART.tracer_var_namesCICE_RESTART.tracer_x_coordCICE_RESTART.tracer_y_coordCICE_RESTART.u_var_nameCICE_RESTART.u_x_coordCICE_RESTART.u_y_coordCICE_RESTART.v_var_nameCICE_RESTART.v_x_coordCICE_RESTART.v_y_coord
find_cice_index_window()
- CrocoDash.raw_data_access.datasets.empty_products module
- CrocoDash.raw_data_access.datasets.era5 module
ERA5_WAVE_SPECTRAERA5_WAVE_SPECTRA.calendarERA5_WAVE_SPECTRA.descriptionERA5_WAVE_SPECTRA.direction_conventionERA5_WAVE_SPECTRA.get_era5_2d_spectra()ERA5_WAVE_SPECTRA.land_markerERA5_WAVE_SPECTRA.linkERA5_WAVE_SPECTRA.loggerERA5_WAVE_SPECTRA.product_nameERA5_WAVE_SPECTRA.time_unitsERA5_WAVE_SPECTRA.time_var_name
build_era5_spectra_request()decode_era5_spectra_grib()
- CrocoDash.raw_data_access.datasets.gebco module
- CrocoDash.raw_data_access.datasets.glofas module
- CrocoDash.raw_data_access.datasets.glorys module
GLORYSGLORYS.boundary_fill_methodGLORYS.calendarGLORYS.depth_coordGLORYS.descriptionGLORYS.eta_var_nameGLORYS.get_glorys_data_from_cds_api()GLORYS.get_glorys_data_from_rda()GLORYS.get_glorys_data_script_for_cli()GLORYS.linkGLORYS.loggerGLORYS.product_nameGLORYS.time_unitsGLORYS.time_var_nameGLORYS.tracer_lat_coordGLORYS.tracer_lon_coordGLORYS.tracer_var_namesGLORYS.tracer_x_coordGLORYS.tracer_y_coordGLORYS.u_lat_coordGLORYS.u_lon_coordGLORYS.u_var_nameGLORYS.u_x_coordGLORYS.u_y_coordGLORYS.v_lat_coordGLORYS.v_lon_coordGLORYS.v_var_nameGLORYS.v_x_coordGLORYS.v_y_coord
- CrocoDash.raw_data_access.datasets.reference module
REFERENCE_ICEREFERENCE_ICE.calendarREFERENCE_ICE.depth_coordREFERENCE_ICE.descriptionREFERENCE_ICE.get_reference_ice_data()REFERENCE_ICE.linkREFERENCE_ICE.loggerREFERENCE_ICE.product_nameREFERENCE_ICE.time_unitsREFERENCE_ICE.time_var_nameREFERENCE_ICE.tracer_var_namesREFERENCE_ICE.tracer_x_coordREFERENCE_ICE.tracer_y_coordREFERENCE_ICE.u_var_nameREFERENCE_ICE.u_x_coordREFERENCE_ICE.u_y_coordREFERENCE_ICE.v_var_nameREFERENCE_ICE.v_x_coordREFERENCE_ICE.v_y_coord
REFERENCE_OCEANREFERENCE_OCEAN.boundary_fill_methodREFERENCE_OCEAN.calendarREFERENCE_OCEAN.depth_coordREFERENCE_OCEAN.descriptionREFERENCE_OCEAN.eta_var_nameREFERENCE_OCEAN.get_reference_ocean_data()REFERENCE_OCEAN.linkREFERENCE_OCEAN.loggerREFERENCE_OCEAN.marbl_var_namesREFERENCE_OCEAN.product_nameREFERENCE_OCEAN.time_unitsREFERENCE_OCEAN.time_var_nameREFERENCE_OCEAN.tracer_lat_coordREFERENCE_OCEAN.tracer_lon_coordREFERENCE_OCEAN.tracer_var_namesREFERENCE_OCEAN.tracer_x_coordREFERENCE_OCEAN.tracer_y_coordREFERENCE_OCEAN.u_lat_coordREFERENCE_OCEAN.u_lon_coordREFERENCE_OCEAN.u_var_nameREFERENCE_OCEAN.u_x_coordREFERENCE_OCEAN.u_y_coordREFERENCE_OCEAN.v_lat_coordREFERENCE_OCEAN.v_lon_coordREFERENCE_OCEAN.v_var_nameREFERENCE_OCEAN.v_x_coordREFERENCE_OCEAN.v_y_coord
REFERENCE_WAVES
- CrocoDash.raw_data_access.datasets.seawifs module
- CrocoDash.raw_data_access.datasets.srtm module
- CrocoDash.raw_data_access.datasets.utils module
- Module contents
Submodules#
CrocoDash.raw_data_access.base module#
Raw Data Access Module Requirements: 1. Must enforce a certain amount of metadata for each product (things like z coordinate name, u velocity name, etc) (from the parent class) 2. Must enforce specific keyword args in each access function (from the parent class) 3. There must be some sort of registry that can list/query all products & access methods 4. As minimal overhead as possible (for me, that meant no initialization!) 5. Should be easy to validate the function (easy to test if they work and the metadata) 6. Should be easy to validate the metadata 7. Need to be able to print out the available products, functions, and their respective descriptions.
How it was solved: 1. There is a set of “abstract” classes that specify an array of “required_metadata”. There is no type enforcement currently. This is checked in the _init_subclass hook. 2. There is a set of “abstract” classes that specify an array of “required_args”. There is no type enforcement. This is checked in the _init_subclass hook. 3. There is a class called ProductRegistry in the registry.py file that does this 4. The classes are all static. 5. There is a validate method in the BaseProduct class that takes in additional default args from child classes, and the _init_subclass hook validates the args. 6. The metadata is validated in the _init_subclass hook 7. The ProductRegistry holds all of that.
- class CrocoDash.raw_data_access.base.BaseProduct#
Bases:
objectBase class for all raw data products. It enforces the metadata on the product as well as the function args.
- required_args = ['output_folder', 'output_filename']#
- required_metadata = ['product_name', 'description', 'link']#
- classmethod validate_call(method_name, **kwargs)#
Validate that a call to an access method has correct arguments.
- classmethod validate_method(method_name, **kwargs)#
Default validation just makes a toy call with a temporary directory.
Returns True if the call succeeds, False if it raises. The call’s own result is not passed on: whatever it wrote went to the temporary directory, which is removed before this returns.
- classmethod write_metadata(file_path: str = None) dict#
Return a dict of the class metadata fields and their values, writes a file if a filepath is specified.
- class CrocoDash.raw_data_access.base.CICEForcingProduct#
Bases:
VelocityTracerForcingProductCICE’s own regridding var-name metadata. CICE’s B-grid velocity (uvel/vvel) and tracer-like state both live on the same (nj, ni) index space (no MOM6-style C-grid staggering across separately named dims), so this extends VelocityTracerForcingProduct rather than ForcingProduct directly – any concrete CICE product regridded via regional_mom6.Segment reuses the same var-map contract MOM6 does.
- class CrocoDash.raw_data_access.base.Calendar(cf: str, cesm: str, mom6: str)#
Bases:
objectPairs the calendar name each downstream consumer expects, so a product can’t declare one without the others.
cf is for xarray’s own time decode/encode while reading raw data (its CF convention name, e.g. “standard” for the real-world calendar). cesm is the CESM xml value. mom6 (FMS) is the string the netcdf files must have on time:calendar attribute, since it is not necessarily the same as cf OR cesm.
- cesm: str#
- cf: str#
- classmethod from_config(section: dict) Calendar#
Rebuild a Calendar from the
calendarobject in a config.json section.Reads the copy the chl / river-nutrients configurators store in their own
inputsblock, so the extraction driver can hand those writers the whole Calendar rather than one name and a guess about which of its roles that name was meant for. The product metadata block is a separate copy, written by BaseProduct.write_metadata and read directly by the OBC step; it does not come through here.
- mom6: str#
- class CrocoDash.raw_data_access.base.DatedBaseProduct#
Bases:
BaseProductSpecific enforcement needs for Dated Products
- required_args = ['output_folder', 'output_filename', 'dates']#
- classmethod validate_method(method_name, **kwargs)#
Default validation just makes a toy call with a temporary directory.
Returns True if the call succeeds, False if it raises. The call’s own result is not passed on: whatever it wrote went to the temporary directory, which is removed before this returns.
- class CrocoDash.raw_data_access.base.ForcingProduct#
Bases:
DatedBaseProductGeneric enforcement for any gridded, bounding-box-downloadable forcing product. Holds the metadata every such product needs regardless of target model: a lat/lon/variables/dates download contract, sane toy-call defaults for that contract’s lat/lon args, and its own time-axis naming (
time_var_name/time_units/calendar) – every dated forcing product has some time coordinate to name, even one (like a static restart snapshot) that leaves these unused. Velocity/ tracer grid-point metadata is NOT here – seeVelocityTracerForcingProduct/MOM6ForcingProduct.- required_args = ['output_folder', 'output_filename', 'dates', 'variables', 'lon_max', 'lat_max', 'lon_min', 'lat_min', 'name']#
- required_metadata = ['product_name', 'description', 'link', 'time_var_name', 'time_units', 'calendar']#
- classmethod validate_method(method_name, **kwargs)#
Default validation just makes a toy call with a temporary directory.
Returns True if the call succeeds, False if it raises. The call’s own result is not passed on: whatever it wrote went to the temporary directory, which is removed before this returns.
- class CrocoDash.raw_data_access.base.MOM6ForcingProduct#
Bases:
VelocityTracerForcingProductMOM6/regional_mom6-specific regridding metadata on top of
VelocityTracerForcingProduct– SSH and the OBC fill method, neither of which generalize to other models. Products that feed CrocoDash’s MOM6 OBC/IC pipeline (GLORYS,CESM_POP_OUTPUT,CESM_MOM_OUTPUT) extend this.- required_metadata = ['product_name', 'description', 'link', 'time_var_name', 'time_units', 'calendar', 'u_x_coord', 'u_y_coord', 'v_x_coord', 'v_y_coord', 'tracer_x_coord', 'tracer_y_coord', 'u_var_name', 'v_var_name', 'tracer_var_names', 'depth_coord', 'eta_var_name', 'boundary_fill_method']#
- classmethod write_metadata(file_path: str | None = None, include_marbl_tracers=False) dict#
Return a dict of the class metadata fields and their values, writes a file if a filepath is specified.
- class CrocoDash.raw_data_access.base.VelocityTracerForcingProduct#
Bases:
ForcingProductCoordinate/variable-name metadata for a product’s u/v velocity and tracer grid points – the var-map contract consumed by
regional_mom6’sSegment.regrid_velocity_tracers, not by the generic GET layer. Shared byMOM6ForcingProductand any future model whose velocity/tracer state lives on a plain (nj, ni) index space.- required_metadata = ['product_name', 'description', 'link', 'time_var_name', 'time_units', 'calendar', 'u_x_coord', 'u_y_coord', 'v_x_coord', 'v_y_coord', 'tracer_x_coord', 'tracer_y_coord', 'u_var_name', 'v_var_name', 'tracer_var_names', 'depth_coord']#
- class CrocoDash.raw_data_access.base.WW3ForcingProduct#
Bases:
ForcingProductExtension point for WW3’s own regridding var-name metadata, beyond ForcingProduct’s generic time-axis contract. No velocity/tracer grid metadata here – WW3 boundary spectra have no such grid.
direction_conventionandland_markerare required because they are the two pieces of spectral metadata that cannot be inferred from the data. A spectrum and the same spectrum rotated 180 degrees are both perfectly plausible files; so are a land cell and a becalmed one. Only the product knows which it is emitting.- required_metadata = ['product_name', 'description', 'link', 'time_var_name', 'time_units', 'calendar', 'direction_convention', 'land_marker']#
- CrocoDash.raw_data_access.base.accessmethod(func=None, *, description=None, type=None, how_to_use=None)#
CrocoDash.raw_data_access.registry module#
- class CrocoDash.raw_data_access.registry.ProductRegistry#
Bases:
objectStatic registry that tracks all products and provides driver-like introspection.
- classmethod call(product_name, method_name, **kwargs)#
- classmethod get_access_function(product_name, method_name)#
Return the raw function (unbound), even if staticmethod.
- classmethod get_function_default_args(product_name, function_name, serializable=False)#
Return a dict of {param: default} for all non-required parameters of an access method; with serializable, as config.json stores them (json_safe).
- classmethod get_product(name)#
- classmethod list_access_methods(name)#
- classmethod list_products()#
- classmethod load()#
- loaded = False#
- classmethod product_exists(name)#
- classmethod product_is_of_type(name, the_class)#
- products = {}#
- classmethod register(product_cls)#
Register a product class.
- classmethod validate_function(product_name, method_name)#
- CrocoDash.raw_data_access.registry.json_safe(args)#
Function arguments as config.json stores them: Paths become strings.