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
NinJo cannot read geostationary projections, and the ninjogeotiff writer cannot write geostationary projections. When the user tries this anyway, NinJoGeoTIFFWriter.get_projection() is supposed to give a helpful error message when called during tag collection. But the order of tag collection is undefined, and sometimes NinJoGeoTIFFWriter.get_ref_lat_1() gets called first and fails with a different error message. This error message is particularly unhelpful if data come from a GeoSegmentYAMLReader, as the original area description is lost and is just called fill.
The desirable behaviour sometimes happens when passing 40 granules:
Traceback (most recent call last):
File "/data/gholl/checkouts/protocode/mwe/ngt-unhelpful-error-message.py", line 7, in <module>
sc.save_dataset("ir_105",
File "/data/gholl/checkouts/satpy/satpy/scene.py", line 1234, in save_datasetreturn writer.save_dataset(self[dataset_id],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/__init__.py", line 885, in save_datasetreturnself.save_image(img, filename=filename, compute=compute, fill_value=fill_value, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/ninjogeotiff.py", line 193, in save_image
ninjo_tags = {f"ninjo_{k:s}": v for (k, v) in ntg.get_all_tags().items()}
^^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/ninjogeotiff.py", line 346, in get_all_tags
tags[tag] =self.get_tag(tag)
^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/ninjogeotiff.py", line 362, in get_tagreturngetattr(self, f"get_{self.dynamic_tags[tag]:s}")()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/ninjogeotiff.py", line 463, in get_projectionraiseValueError(
ValueError: Unknown mapping from area 'MTG FCI Full Disk Scanning Service area definition with 1 km resolution' with CRS coordinate operation name Geostationary Satellite (Sweep Y) to NinJo projection. NinJo understands only equidistant cylindrical, mercator, or stereographic projections.
Although even here, we might add a hint that the user needs to resample the data to a non-geostationary projection (or to a lat/lon unprojected area).
Actual results
However, when passing less than 40 granules and using filling, the best case is:
Traceback (most recent call last):
File "/data/gholl/checkouts/protocode/mwe/ngt-unhelpful-error-message.py", line 7, in <module>
sc.save_dataset("ir_105",
File "/data/gholl/checkouts/satpy/satpy/scene.py", line 1234, in save_datasetreturn writer.save_dataset(self[dataset_id],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/__init__.py", line 885, in save_datasetreturnself.save_image(img, filename=filename, compute=compute, fill_value=fill_value, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/ninjogeotiff.py", line 193, in save_image
ninjo_tags = {f"ninjo_{k:s}": v for (k, v) in ntg.get_all_tags().items()}
^^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/ninjogeotiff.py", line 346, in get_all_tags
tags[tag] =self.get_tag(tag)
^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/ninjogeotiff.py", line 362, in get_tagreturngetattr(self, f"get_{self.dynamic_tags[tag]:s}")()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/ninjogeotiff.py", line 463, in get_projectionraiseValueError(
ValueError: Unknown mapping from area 'fill' with CRS coordinate operation name Geostationary Satellite (Sweep Y) to NinJo projection. NinJo understands only equidistant cylindrical, mercator, or stereographic projections.
Worse, in some cases we get:
Traceback (most recent call last):
File "/data/gholl/checkouts/protocode/mwe/ngt-unhelpful-error-message.py", line 7, in <module>
sc.save_dataset("ir_105",
File "/data/gholl/checkouts/satpy/satpy/scene.py", line 1234, in save_datasetreturn writer.save_dataset(self[dataset_id],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/__init__.py", line 885, in save_datasetreturnself.save_image(img, filename=filename, compute=compute, fill_value=fill_value, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/ninjogeotiff.py", line 193, in save_image
ninjo_tags = {f"ninjo_{k:s}": v for (k, v) in ntg.get_all_tags().items()}
^^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/ninjogeotiff.py", line 346, in get_all_tags
tags[tag] =self.get_tag(tag)
^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/ninjogeotiff.py", line 362, in get_tagreturngetattr(self, f"get_{self.dynamic_tags[tag]:s}")()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/gholl/checkouts/satpy/satpy/writers/ninjogeotiff.py", line 480, in get_ref_lat_1raiseValueError(
ValueError: Could not find reference latitude for area fill
Which one happens appears undefined. A user came to me with the justified question what "Could not find reference latitude for area fill" means.
Environment Info:
OS: Linux
Satpy Version: main
Additional context
The error message could be improved by:
Ensuring get_projection() gets called before get_ref_lat_1(), or
Calling a dedicated method that ensures the data can be stored as ninjogeotiff, or
Adding a helpful hint to the error message in get_ref_lat_1().
In addition, we could consider the filled area to have a description that includes the original area description (f"filled area derived from {orig_area.description:s}" or so).
The text was updated successfully, but these errors were encountered:
Describe the bug
NinJo cannot read geostationary projections, and the ninjogeotiff writer cannot write geostationary projections. When the user tries this anyway,
NinJoGeoTIFFWriter.get_projection()
is supposed to give a helpful error message when called during tag collection. But the order of tag collection is undefined, and sometimesNinJoGeoTIFFWriter.get_ref_lat_1()
gets called first and fails with a different error message. This error message is particularly unhelpful if data come from aGeoSegmentYAMLReader
, as the original area description is lost and is just calledfill
.To Reproduce
Expected behaviour
The desirable behaviour sometimes happens when passing 40 granules:
Although even here, we might add a hint that the user needs to resample the data to a non-geostationary projection (or to a lat/lon unprojected area).
Actual results
However, when passing less than 40 granules and using filling, the best case is:
Worse, in some cases we get:
Which one happens appears undefined. A user came to me with the justified question what "Could not find reference latitude for area fill" means.
Environment Info:
Additional context
The error message could be improved by:
get_projection()
gets called beforeget_ref_lat_1()
, orget_ref_lat_1()
.In addition, we could consider the filled area to have a description that includes the original area description (
f"filled area derived from {orig_area.description:s}"
or so).The text was updated successfully, but these errors were encountered: