pytroll / satpy

Python package for earth-observing satellite data processing
http://satpy.readthedocs.org/en/latest/
GNU General Public License v3.0
1.04k stars 287 forks source link

Saving and reloading a TIF does not preserve area name + id #2748

Open simonrp84 opened 4 months ago

simonrp84 commented 4 months ago

Describe the bug If I save a satpy Scene as a tif file and then reload it, the area attribute is not complete: It is missing the area_id, description and projection_id.

To Reproduce

scn = Scene(some_himawari_files, reader='ahi_hsd')
print(scn['B07'].attrs['area'])
scn.save_dataset('B07', filename='test.tif')

scn2 = Scene(['test.tif'], reader='generic_image')
scn2.load(['image'])
print(scn2['image'].attrs['area'])

Expected behavior Printouts from scn and scn2 areas that are identical.

Actual results The printout from scn2 does not have some attributes: scn:

Area ID: FLDK
Description: AHI FLDK area
Projection ID: geosh9
Projection: {'a': '6378137', 'h': '35785863', 'lon_0': '140.7', 'no_defs': 'None', 'proj': 'geos', 'rf': '298.257024882273', 'type': 'crs', 'units': 'm', 'x_0': '0', 'y_0': '0'}
Number of columns: 5500
Number of rows: 5500
Area extent: (-5499999.9012, -5499999.9012, 5499999.9012, 5499999.9012)

scn2:

Area ID: None
Description: None
Projection ID: unknown
Projection: {'a': '6378137', 'h': '35785863', 'lon_0': '140.7', 'no_defs': 'None', 'proj': 'geos', 'rf': '298.257024882273', 'type': 'crs', 'units': 'm', 'x_0': '0', 'y_0': '0'}
Number of columns: 5500
Number of rows: 5500
Area extent: (-5499999.9012, -5499999.9012, 5499999.9012, 5499999.9012)

Environment Info:

gerritholl commented 4 months ago

I don't think that information can be portably stored in Thousands of Incompatible File Formats (TIFF) files. At DWD we used to have a production chain where we stored and read again TIFF files, but switched to NetCDF for this reason. Satpy could invent a way to store its metadata in a TIFF header and then introduce a specific reader for this (it wouldn't be a generic image reader but a dedicated satpy-tiff reader), but by then NetCDF-CF is arguably really the more appropriate fileformaat.