diff --git a/src/main/python/gov/usgs/earthquake/nshmp/netcdf/utils/netcdf_attributes.py b/src/main/python/gov/usgs/earthquake/nshmp/netcdf/utils/netcdf_attributes.py index f4b32a3346569255cac1f1082cc6476a84907344..e0e79cb98cf3d157373af8955bf19177a6182844 100644 --- a/src/main/python/gov/usgs/earthquake/nshmp/netcdf/utils/netcdf_attributes.py +++ b/src/main/python/gov/usgs/earthquake/nshmp/netcdf/utils/netcdf_attributes.py @@ -20,28 +20,34 @@ class NetcdfAttributes: @dataclass class GridMaskAttributes(NetcdfVariableAttributes): - description: str = "grid mask identifying lon,lat points with valid data" + description: str = "Grid mask identifying lon,lat points with valid data" flags: str = "0: no data, >0: number of hazard curves written to the grid point (lon,lat)" long_name: str = "Hazard Grid Mask" @dataclass class HazardAttributes(NetcdfVariableAttributes): + description: str = ( + "Hazard curves with dimensions [siteClass X imt X latitude X longitude X imls]" + ) long_name: str = "Hazard Curves" number_of_significant_figures: int = 9 units: str = "Annual Frequency of Exceedance" @dataclass class ImlAttributes(NetcdfVariableAttributes): + description: str = "The intensity measure levels" long_name: str = "Intensity Measurement Level" number_of_significant_figures: int = 3 units: str = "g" @dataclass class ImtAttributes(NetcdfVariableAttributes): + description: str = "The intensity measure type, uses NetCDF imt_t enum type" long_name: str = "Intensity Measurement Type" @dataclass class SiteClassAttributes(NetcdfVariableAttributes): + description: str = "The NEHERP site classes, uses NetCDF siteClass_t enum type" long_name: str = "NEHRP Site Class" @dataclass diff --git a/src/main/python/gov/usgs/earthquake/nshmp/netcdf/utils/netcdf_parameters.py b/src/main/python/gov/usgs/earthquake/nshmp/netcdf/utils/netcdf_parameters.py index 679e775d36b645ca9bf08c51dce204ed466fef9f..b61a03107d3976d35e8ad5abbde30e68d5c544d0 100644 --- a/src/main/python/gov/usgs/earthquake/nshmp/netcdf/utils/netcdf_parameters.py +++ b/src/main/python/gov/usgs/earthquake/nshmp/netcdf/utils/netcdf_parameters.py @@ -1,13 +1,3 @@ -""" -Standard parameters and attributes for NSHMP netCDF variables. - -* Parameters = dictionary of named parameters to be passed into ncGroup.createVariable() - May contain parameters such as zlib, shuffle, least_significant_digit, chunksizes, etc. -* Attributes = dictionary of attributes to be set for the variable - May contain arbitrary key-value pairs, attributes named 'key' will be assigned 'value' -* Chunk size indices set to 0 will be set to the dimension size -""" - from dataclasses import asdict, dataclass, field from typing import Union @@ -21,6 +11,13 @@ from .netcdf_utils import NetcdfUtils @dataclass class NetcdfVariableParameters: + """NetCDF parameters + + NetCDF parameters for creating NetCDF variables + See: https://unidata.github.io/netcdf4-python/#Dataset.createVariable + for options + """ + attributes: dict = field(default_factory=lambda: NetcdfVariableAttributes().dict()) datatype: Union[str, type(str), netcdf.EnumType] = field( default_factory=Union[str, type(str), netcdf.EnumType] @@ -45,7 +42,7 @@ class NetcdfParameters: default_factory=lambda: NetcdfAttributes().BoundsAttributes().dict() ) datatype: type(str) = str - dimensions: tuple[str] = field(default_factory=lambda: (NetcdfKeys.DATA_BOUNDS,)) + dimensions: tuple[str] = field(default_factory=lambda: ()) varname: str = NetcdfKeys.DATA_BOUNDS @dataclass