File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
e3sm_to_cmip/cmor_handlers/vars Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 1111import xarray as xr
1212
1313from e3sm_to_cmip ._logger import _setup_child_logger
14+ from e3sm_to_cmip .cmor_handlers import FILL_VALUE
1415from e3sm_to_cmip .util import print_message , setup_cmor
1516
1617logger = _setup_child_logger (__name__ )
@@ -156,6 +157,12 @@ def handle( # noqa: C901
156157
157158 varid = cmor .variable (VAR_NAME , VAR_UNITS , axis_ids )
158159
160+ # Replace NaNs in data with appropriate fill-value for cmor.write,
161+ # which does not support np.nan as a fill value.
162+ data ["FISCCP1_COSP" ] = np .where (
163+ np .isnan (data ["FISCCP1_COSP" ]), FILL_VALUE , data ["FISCCP1_COSP" ]
164+ )
165+
159166 # write out the data
160167 msg = f"{ VAR_NAME } : time { data ['time_bnds' ][0 ][0 ]:1.1f} - { data ['time_bnds' ][- 1 ][- 1 ]:1.1f} "
161168 logger .info (msg )
You can’t perform that action at this time.
0 commit comments