Description
I am using the XarrayProvider and XarrayEDRProvider with a netcdf file and the XarrayProvider.gen_covjson() seems to be tripping over itself. If the dataset has missing values as NaN, they are converted to None and then fail during serialization because np.isnan on None raises a TypeError.
starting at Line 400 pygeoapi/provider/xarray_.py
data = data.fillna(None)
try:
for key, value in selected_fields.items():
LOGGER.debug(f'Adding range {key}')
range = {
'type': 'NdArray',
'dataType': value['type'],
'axisNames': [
'y', 'x'
],
'shape': [
metadata['height'], metadata['width']
],
'values': [
None if np.isnan(v) else v
for v in data[key].values.flatten()
]
}
I don't think I understand the point of setting None here if the code is checking for nan.
Description
I am using the XarrayProvider and XarrayEDRProvider with a netcdf file and the
XarrayProvider.gen_covjson()seems to be tripping over itself. If the dataset has missing values as NaN, they are converted to None and then fail during serialization becausenp.isnanon None raises a TypeError.starting at Line 400 pygeoapi/provider/xarray_.py
I don't think I understand the point of setting None here if the code is checking for nan.