graincode_converter module#
- xsnow.graincode_converter.slf_graincode_to_ICSSG_primary(graincodes)#
Return primary ICSSG labels for SLF grain codes.
- Parameters:
graincodes (xarray.DataArray or array-like (int/float)) – 1-, 2-, or 3-digit SLF grain codes. NaNs allowed.
- Returns:
Primary grain labels.
- Return type:
xarray.DataArray (dtype=object)
Notes
1-digit code: primary == that digit’s label; secondary == same; cycle=”dry”.
2-digit code: primary, secondary from digits; cycle=”dry”.
3-digit code: third digit is cycle (0=”dry”, 1=”mel”, 2=”rfr”).
If cycle == 2: primary = “MFcr”
Examples
>>> import xarray as xr >>> codes = xr.DataArray([3, 33, 332, np.nan]) >>> slf_graincode_to_ICSSG_primary(codes).values array(['RG', 'RG', 'MFcr', None], dtype=object)
- xsnow.graincode_converter.slf_graincode_to_ICSSG_secondary(graincodes)#
Return secondary ICSSG labels for SLF grain codes.
- Parameters:
graincodes (xarray.DataArray or array-like (int/float)) – 1-, 2-, or 3-digit SLF grain codes. NaNs allowed.
- Returns:
Secondary grain labels.
- Return type:
xarray.DataArray (dtype=object)
Notes
See slf_graincode_to_ICSSG_primary() for more details.
Examples
>>> import xarray as xr >>> codes = xr.DataArray([3, 33, 332, np.nan]) >>> slf_graincode_to_ICSSG_secondary(codes).values array(['RG', 'RG', 'RG', None], dtype=object)