You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Resampling with the gradient_search resampler results in a scene where the datasets are missing the CRS coordinate. Writing the resulting file with the CF writer results in file where the y and x coordinates have projection_y_coordinate and projection_x_coordinate as a standard_name attribute rather than latitude and longitude. The satpy NetCDF reader subsequently cannot reconstruct an area for those data.
I expect that the crs coordinate is retained and a CF-conformant NetCDF file is written, that satpy can itself read. The behaviour is as expected when I use resampler="nearest":
/home/gholl/miniforge3/envs/py313/lib/python3.13/site-packages/sattools/__init__.py:2: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
from pkg_resources import get_distribution, DistributionNotFound
[DEBUG: 2025-02-06 16:24:59 : satpy.readers.yaml_reader] Reading ('/home/gholl/miniforge3/envs/py313/lib/python3.13/site-packages/satpy/etc/readers/abi_l1b.yaml',)
[DEBUG: 2025-02-06 16:25:00 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/media/nas/x21308/scratch/wcm/in/OR_ABI-L1b-RadF-M6C13_G16_s20222791200206_e20222791209526_c20222791209590.nc']
[DEBUG: 2025-02-06 16:25:00 : satpy.composites.config_loader] Looking for composites config file abi.yaml
[DEBUG: 2025-02-06 16:25:00 : pyorbital.tlefile] Path to the Pyorbital configuration (where e.g. platforms.txt is found): /home/gholl/miniforge3/envs/py313/lib/python3.13/site-packages/pyorbital/etc
[DEBUG: 2025-02-06 16:25:00 : satpy.composites.config_loader] Looking for composites config file visir.yaml
[DEBUG: 2025-02-06 16:25:00 : satpy.readers.abi_l1b] Reading in get_dataset C13.
[DEBUG: 2025-02-06 16:25:00 : satpy.scene] Resampling DataID(name='C13', wavelength=WavelengthRange(min=10.1, central=10.35, max=10.6, unit='µm'), resolution=2000, calibration=<2>, modifiers=())
[DEBUG: 2025-02-06 16:25:10 : satpy.resample] Computing kd-tree parameters
[DEBUG: 2025-02-06 16:25:10 : satpy.resample] Resampling Rad
[DEBUG: 2025-02-06 16:25:10 : satpy.writers] Reading ['/home/gholl/miniforge3/envs/py313/lib/python3.13/site-packages/satpy/etc/writers/cf.yaml']
[INFO: 2025-02-06 16:25:10 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
/home/gholl/miniforge3/envs/py313/lib/python3.13/site-packages/satpy/cf/attrs.py:212: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
_history_create = "Created by pytroll/satpy on {}".format(datetime.datetime.utcnow())
/home/gholl/miniforge3/envs/py313/lib/python3.13/site-packages/dask/_task_spec.py:741: RuntimeWarning: invalid value encountered in cos
return self.func(*new_argspec)
/home/gholl/miniforge3/envs/py313/lib/python3.13/site-packages/dask/_task_spec.py:741: RuntimeWarning: invalid value encountered in sin
return self.func(*new_argspec)
Coordinates:
crs object 8B GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ...
* y (y) float64 53kB 89.91 89.88 89.86 89.83 ... -89.86 -89.88 -89.91
* x (x) float64 107kB -179.8 -179.8 -179.8 -179.8 ... 179.8 179.8 179.9
<sys>:0: DeprecationWarning: Call to deprecated function (or staticmethod) _destroy.
/home/gholl/miniforge3/envs/py313/lib/python3.13/site-packages/sattools/__init__.py:2: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
from pkg_resources import get_distribution, DistributionNotFound
[DEBUG: 2025-02-06 16:23:47 : satpy.readers.yaml_reader] Reading ('/home/gholl/miniforge3/envs/py313/lib/python3.13/site-packages/satpy/etc/readers/abi_l1b.yaml',)
[DEBUG: 2025-02-06 16:23:47 : satpy.readers.yaml_reader] Assigning to abi_l1b: ['/media/nas/x21308/scratch/wcm/in/OR_ABI-L1b-RadF-M6C13_G16_s20222791200206_e20222791209526_c20222791209590.nc']
[DEBUG: 2025-02-06 16:23:47 : satpy.composites.config_loader] Looking for composites config file abi.yaml
[DEBUG: 2025-02-06 16:23:48 : pyorbital.tlefile] Path to the Pyorbital configuration (where e.g. platforms.txt is found): /home/gholl/miniforge3/envs/py313/lib/python3.13/site-packages/pyorbital/etc
[DEBUG: 2025-02-06 16:23:48 : satpy.composites.config_loader] Looking for composites config file visir.yaml
[DEBUG: 2025-02-06 16:23:48 : satpy.readers.abi_l1b] Reading in get_dataset C13.
[DEBUG: 2025-02-06 16:23:48 : satpy.scene] Resampling DataID(name='C13', wavelength=WavelengthRange(min=10.1, central=10.35, max=10.6, unit='µm'), resolution=2000, calibration=<2>, modifiers=())
[DEBUG: 2025-02-06 16:23:58 : satpy.writers] Reading ['/home/gholl/miniforge3/envs/py313/lib/python3.13/site-packages/satpy/etc/writers/cf.yaml']
[INFO: 2025-02-06 16:23:58 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
/home/gholl/miniforge3/envs/py313/lib/python3.13/site-packages/satpy/cf/attrs.py:212: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
_history_create = "Created by pytroll/satpy on {}".format(datetime.datetime.utcnow())
[WARNING: 2025-02-06 16:23:58 : satpy.cf.coords] Failed to tell if data are projected. Assuming yes.
Coordinates:
* y (y) float64 53kB 89.91 89.88 89.86 89.83 ... -89.86 -89.88 -89.91
* x (x) float64 107kB -179.8 -179.8 -179.8 -179.8 ... 179.8 179.8 179.9
<sys>:0: DeprecationWarning: Call to deprecated function (or staticmethod) _destroy.
Note also the warning from the CF writer, which fails to tell if the data are projected. The resulting NetCDF file has wrong attributes for the x and y coordinates:
Subsequently, the satpy netcdf reader cannot reconstruct an area:
from satpy import Scene
sc = Scene(filenames={"satpy_cf_nc": ["GOES-16-abi-20221006120020-20221006120952.nc"]})
sc.load(["C13"])
print(sc["C13"].attrs["area"])
gerritholl
changed the title
gradient_search resampler drops CRS
gradient_search resampler drops CRS coordinate, leading to non-conform NetCDF files that satpy can't reconstruct an area from
Feb 6, 2025
gerritholl
changed the title
gradient_search resampler drops CRS coordinate, leading to non-conform NetCDF files that satpy can't reconstruct an area from
gradient_search resampler drops CRS coordinate, leading to non-conform NetCDF files, from which satpy fails to reconstruct an area
Feb 6, 2025
Describe the bug
Resampling with the
gradient_search
resampler results in a scene where the datasets are missing theCRS
coordinate. Writing the resulting file with theCF
writer results in file where they
andx
coordinates haveprojection_y_coordinate
andprojection_x_coordinate
as astandard_name
attribute rather thanlatitude
andlongitude
. The satpy NetCDF reader subsequently cannot reconstruct an area for those data.To Reproduce
Expected behavior
I expect that the
crs
coordinate is retained and a CF-conformant NetCDF file is written, that satpy can itself read. The behaviour is as expected when I useresampler="nearest"
:Result of
ncdump -h
:Actual results
Note also the warning from the CF writer, which fails to tell if the data are projected. The resulting NetCDF file has wrong attributes for the
x
andy
coordinates:Subsequently, the satpy netcdf reader cannot reconstruct an area:
fails with
KeyError
.Environment Info:
Additional context
Area definition for the MCVE:
The text was updated successfully, but these errors were encountered: