diff --git a/diagnostics/SM_ET_coupling/settings.jsonc b/diagnostics/SM_ET_coupling/settings.jsonc index 2850b3ff4..79c028a21 100644 --- a/diagnostics/SM_ET_coupling/settings.jsonc +++ b/diagnostics/SM_ET_coupling/settings.jsonc @@ -8,7 +8,6 @@ "settings" : { "driver" : "SM_ET_coupling.py", "long_name" : "Coupling between Soil Moisture and EvapoTranspiration", - "realm" : ["atmos", "land"], "convention" : "cmip", "description" : "Coupling of Soil Moisture with Evapotranspiration", "runtime_requirements": { diff --git a/diagnostics/forcing_feedback/settings.jsonc b/diagnostics/forcing_feedback/settings.jsonc index a77f42b19..97d14ba52 100644 --- a/diagnostics/forcing_feedback/settings.jsonc +++ b/diagnostics/forcing_feedback/settings.jsonc @@ -3,7 +3,6 @@ "driver" : "forcing_feedback.py", "long_name" : "Radiative Forcing and Feedback Diagnostics", "convention" : "cmip", - "realm" : "atmos", "runtime_requirements": { "python3": ["os", "numpy", "xarray", "pandas", "netCDF4", "scipy", "matplotlib", "cartopy"] }, @@ -21,7 +20,8 @@ "min_frequency": "mon", "max_frequency": "mon", "min_duration": "5yr", - "max_duration": "any" + "max_duration": "any", + "realm" : "atmos", }, "dimensions": { "lat": { diff --git a/diagnostics/stc_eddy_heat_fluxes/settings.jsonc b/diagnostics/stc_eddy_heat_fluxes/settings.jsonc index f91d9054f..3cf0e6136 100644 --- a/diagnostics/stc_eddy_heat_fluxes/settings.jsonc +++ b/diagnostics/stc_eddy_heat_fluxes/settings.jsonc @@ -8,7 +8,6 @@ "settings" : { "driver" : "stc_eddy_heat_fluxes.py", "long_name" : "Upward Coupling of Vertically Propagating Planetary Waves", - "realm" : "atmos", "convention" : "cmip", "description" : "Assess the influence of wave driving on the polar stratosphere", "pod_env_vars" : { @@ -28,6 +27,10 @@ "python3": ["matplotlib", "numpy", "pandas", "xarray", "xesmf"] } }, + "data": { + "realm" : "atmos" + }, + "dimensions": { "lat": { "standard_name": "latitude", diff --git a/diagnostics/stc_qbo_enso/settings.jsonc b/diagnostics/stc_qbo_enso/settings.jsonc index f5b1219e1..3b7b8badf 100644 --- a/diagnostics/stc_qbo_enso/settings.jsonc +++ b/diagnostics/stc_qbo_enso/settings.jsonc @@ -8,7 +8,6 @@ "settings" : { "driver" : "stc_qbo_enso.py", "long_name" : "Metrics of QBO and extratropical circulation impact of QBO and ENSO", - "realm" : ["atmos", "ocean"], "description" : "Assess the representation of the QBO", "pod_env_vars" : { // Isobar (hPa) used to define the QBO in the tropical stratosphere @@ -37,6 +36,7 @@ "tos": { "standard_name" : "sea_surface_temperature", "units" : "degC", + "realm": "ocean", "frequency": "mon", "dimensions": ["time", "lat", "lon"], "requirement": "required" @@ -45,6 +45,7 @@ "standard_name" : "eastward_wind", "units" : "m s-1", "frequency": "mon", + "realm": "atmos", "dimensions": ["time", "lev", "lat", "lon"], "requirement": "required" }, @@ -52,12 +53,14 @@ "standard_name" : "northward_wind", "units" : "m s-1", "frequency": "mon", + "realm": "atmos", "dimensions": ["time", "lev", "lat", "lon"], "requirement": "required" }, "ta": { "standard_name" : "air_temperature", "units" : "K", + "realm": "atmos", "frequency": "mon", "dimensions": ["time", "lev", "lat", "lon"], "requirement": "required" @@ -66,6 +69,7 @@ "standard_name" : "air_pressure_at_mean_sea_level", "units" : "Pa", "frequency": "mon", + "realm": "atmos", "dimensions": ["time", "lat", "lon"], "requirement": "required" } diff --git a/diagnostics/stc_spv_extremes/settings.jsonc b/diagnostics/stc_spv_extremes/settings.jsonc index eae75f82b..2306a6003 100644 --- a/diagnostics/stc_spv_extremes/settings.jsonc +++ b/diagnostics/stc_spv_extremes/settings.jsonc @@ -6,7 +6,6 @@ "settings" : { "driver" : "stc_spv_extremes.py", "long_name" : "Stratospheric Polar Vortex Extremes", - "realm" : "atmos", "description" : "Detecting extreme polar vortex events and their surface impacts", "pod_env_vars" : { // Lower latitude limit for polar cap avg calculations (defaults to 65) @@ -19,6 +18,9 @@ "python3": ["matplotlib", "numpy", "pandas", "xarray", "scipy"] } }, + "data": { + "realm" : "atmos" + }, "dimensions": { "lat": {"standard_name": "latitude"}, "lon": {"standard_name": "longitude"}, diff --git a/diagnostics/top_heaviness_metric/settings.jsonc b/diagnostics/top_heaviness_metric/settings.jsonc index ce3b497e7..cca28d72e 100644 --- a/diagnostics/top_heaviness_metric/settings.jsonc +++ b/diagnostics/top_heaviness_metric/settings.jsonc @@ -29,7 +29,7 @@ "varlist": { "omega": { "standard_name": "lagrangian_tendency_of_air_pressure", - "frequency": "mon", + "frequency": "mon", "realm": "atmos", "units": "Pa s-1", "dimensions": ["lev", "lat", "lon"] diff --git a/doc/sphinx/pod_settings.rst b/doc/sphinx/pod_settings.rst index 6b5752c65..9624424d7 100644 --- a/doc/sphinx/pod_settings.rst +++ b/doc/sphinx/pod_settings.rst @@ -33,13 +33,13 @@ Example "settings" : { "long_name": "My example diagnostic", "driver": "example_diagnostic.py", - "realm": "atmos", "runtime_requirements": { "python": ["numpy", "matplotlib", "netCDF4"] } }, "data" : { - "frequency": "day" + "frequency": "day", + "realm": "atmos" }, "dimensions": { "lat": { @@ -84,12 +84,6 @@ This is where you describe your diagnostic and list the programs it needs to run ``driver``: Filename of the driver script the framework should call to run your diagnostic. -``realm``: - One or more of the eight CMIP6 modeling realms (aerosol, atmos, atmosChem, land, landIce, ocean, ocnBgchem, seaIce) - describing what data your diagnostic uses. This is give the user an easy way to, eg, run only ocean diagnostics on - data from an ocean model. Realm can be specified in the `settings`` section, or specified separately for each variable - in the `varlist` section. - ``runtime_requirements``: This is a list of key-value pairs describing the programs your diagnostic needs to run, and any third-party libraries used by those programs. @@ -121,6 +115,12 @@ This section contains settings that apply to all the data your diagnostic uses. Common synonyms for these units are also recognized (e.g. ``monthly``, ``month``, ``months``, ``mo`` for ``mon``, ``static`` for ``fx``, etc.) +``realm``: + One or more of the eight CMIP6 modeling realms (aerosol, atmos, atmosChem, land, landIce, ocean, ocnBgchem, seaIce) + describing what data your diagnostic uses. This is give the user an easy way to, eg, run only ocean diagnostics on + data from an ocean model. Realm can be specified in the `data` section, or specified separately for each variable + in the `varlist` section. + .. _sec_dimensions: Dimensions section @@ -163,7 +163,7 @@ Time **Required**. Must be ``"time"``. ``units``: - String. Optional, defaults to "day". Units the diagnostic expects the dimension to be in. Currently the diagnostic + String, Optional, defaults to "day". Units the diagnostic expects the dimension to be in. Currently the diagnostic only supports time axes of the form " since ", and the value given here is interpreted in this sense (e.g. settings this to "day" would accommodate a dimension of the form "[decimal] days since 1850-01-01".) @@ -220,7 +220,8 @@ Other dimensions (wavelength, ...) employed in the CMIP6 MIP tables. ``units``: - Optional, a :ref:`CFunit`. Units the diagnostic expects the dimension to be in. **If not provided, the framework will assume CF convention** `canonical units `__. + **Required** :ref:`CFunit`, string. Units the diagnostic expects the dimension to be in. Use `1` if the + dimension has no units ``need_bounds``: Boolean, optional. Assumed ``false`` if not specified. If ``true``, the framework will ensure that bounds are supplied @@ -266,14 +267,14 @@ variable. Most settings here are optional, but the main ones are: List of names of dimensions specified in the "dimensions" section, to specify the coordinate dependence of each variable. -``realm`` (if not specified in the `settings` section): +``realm`` (if not specified in the `data` section): string or list of CMIP modeling realm(s) that the variable belongs to ``modifier``: - String, optional; Descriptor to distinguish variables with identical standard names and different dimensionalities or - realms. See `modifiers.jsonc `__ for - supported modfiers. Open an issue to request the addition of a new modifier to the modifiers.jsonc file, or submit a - pull request that includes the new modifier in the modifiers.jsonc file and the necessary POD settings.jsonc file(s). + String, optional; Descriptor to distinguish variables with identical standard names and different dimensionalities or + realms. See `modifiers.jsonc `__ for + supported modifiers. Open an issue to request the addition of a new modifier to the modifiers.jsonc file, or submit a + pull request that includes the new modifier in the modifiers.jsonc file and the necessary POD settings.jsonc file(s). ``requirement``: String. Optional; assumed ``"required"`` if not specified. One of three values: @@ -309,6 +310,7 @@ variable. Most settings here are optional, but the main ones are: - *keys* are the key (name) of an entry in the :ref:`dimensions` section. - *values* are a single number (integer or floating-point) corresponding to the value of the slice to extract. + **Units** of this number are taken to be the ``units`` property of the dimension named as the key. In order to request multiple slices (e.g. wind velocity on multiple pressure levels, with each level saved to a diff --git a/src/varlist_util.py b/src/varlist_util.py index f539af543..97332a4a7 100644 --- a/src/varlist_util.py +++ b/src/varlist_util.py @@ -263,8 +263,9 @@ def from_struct(cls, global_settings_d, dims_d, name, parent, **kwargs): new_kw = global_settings_d.copy() new_kw['coords'] = [] new_kw['convention'] = parent.pod_settings.get('convention', 'cmip') - if parent.pod_settings.get('realm', None) is not None: - new_kw['realm'] = parent.pod_settings.get('realm') # populated if realm defined in pod_env_vars instead + # check if realm is set for all variables + if parent.pod_data.get('realm', None) is not None: + new_kw['realm'] = parent.pod_data.get('realm') # populated if realm defined in pod settings data instead # of an attribute for each POD variable if 'dimensions' not in kwargs: raise ValueError(f"No dimensions specified for Varlist entry {name}.")