Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generic_image reader doesn't read area from .yaml file? #830

Closed
peters77 opened this issue Jun 26, 2019 · 9 comments · Fixed by #925
Closed

generic_image reader doesn't read area from .yaml file? #830

peters77 opened this issue Jun 26, 2019 · 9 comments · Fixed by #925

Comments

@peters77
Copy link
Contributor

Describe the bug
Try to overlay the ir_cloud_day composite on top of a static background image (area: EPSG_4326)

# Your code here

seviri.yaml:

static_day:
    compositor: !!python/name:satpy.composites.StaticImageCompositor
    standard_name: static_day
    filename: /home/cpeters/satpy/backgrounds/world.200407.3x21600x10800.png
    area: EPSG_4326

Expected behavior
Place IR clouds on background image.

Actual results

[DEBUG: 2019-06-26 09:01:32 : satpy.readers.yaml_reader] No coordinates found for DatasetID(name='image', wavelength=None, resolution=None, polarization=None, calibration=None, level=None, modifiers=())
[DEBUG: 2019-06-26 09:01:32 : satpy.readers.generic_image] Reading DatasetID(name='image', wavelength=None, resolution=None, polarization=None, calibration=None, level=None, modifiers=()).
Traceback (most recent call last):
  File "make_msg3_static_day.py", line 190, in <module>
    global_scene.load([composite])
  File "/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/satpy/scene.py", line 969, in load
    keepables = self.generate_composites()
  File "/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/satpy/scene.py", line 884, in generate_composites
    return self._read_composites(nodes)
  File "/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/satpy/scene.py", line 858, in _read_composites
    self._generate_composite(item, keepables)
  File "/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/satpy/scene.py", line 833, in _generate_composite
    **self.attrs)
  File "/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/satpy/composites/__init__.py", line 1415, in __call__
    if img.area.ndim is None:
  File "/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/xarray/core/common.py", line 179, in __getattr__
    (type(self).__name__, name))
AttributeError: 'DataArray' object has no attribute 'area'

Environment Info:

  • OS: [Linux]
  • Satpy Version: [e.g. 0.16.0]
@pnuu
Copy link
Member

pnuu commented Jun 26, 2019

Did you define the area definition for EPSG_4326 in areas.yaml? Based on the filename something like this should work:

EPSG_4326:
  description: Global equal latitude/longitude grid for global sphere
  projection:
    init: EPSG:4326
  shape:
    height: 10800
    width: 21600
  area_extent:
    lower_left_xy: [-180.0, -90.0]
    upper_right_xy: [180.0, 90.0]

@peters77
Copy link
Contributor Author

peters77 commented Jun 26, 2019

Yes, that's in my areas.yaml:

EPSG_4326:
   description: Global equal latitude/longitude grid
   projection:
     init: EPSG:4326
   shape:
     width: 21600
     height: 10800
   area_extent:
     lower_left_xy: [-180.0, -90.0]
     upper_right_xy: [180.0, 90.0]

All worked before upgrading to Satpy 0.16. I think I didn't change anything in the script?

@pnuu
Copy link
Member

pnuu commented Jun 26, 2019

@sfinkens @mraspaud any ideas what might have changed after the StaticImageCompositor were merged to master?

@sfinkens
Copy link
Member

@peters77 Does this also happen with non-EPSG areas definitions?

@peters77
Copy link
Contributor Author

Sorry, I'm not very skilled and don't know how to test?

This works (as it is a geotiff):

  static_night:
    compositor: !!python/name:satpy.composites.StaticImageCompositor
    standard_name: static_night
    filename: /home/cpeters/satpy/backgrounds/BlackMarble_2016_3km_geo.tif

this doesn't work (.png image with area given):

  static_day:
    compositor: !!python/name:satpy.composites.StaticImageCompositor
    standard_name: static_day
    filename: /home/cpeters/satpy/backgrounds/world.200407.3x21600x10800.png
    area: EPSG_4326
#    area: worldeqc30km

To test I tried area: worldeqc30km but same error.

@pnuu
Copy link
Member

pnuu commented Jun 26, 2019

@peters77 you can try by resampling any composite to e.g. eurol, saving to .png and then using that file in filename and area: eurol.

@djhoese
Copy link
Member

djhoese commented Jun 26, 2019

@peters77 Can you show us your full area definition entry in areas.yaml? I don't see anything that says that the area is named EPSG_4326.

@peters77
Copy link
Contributor Author

peters77 commented Jun 27, 2019

@pnuu I tried with (euro4, '/mnt/nfs/rumo/20181001_1200_Meteosat-11_euro4_overview.png', but the same error:

[INFO: 2019-06-26 17:15:01 : hrit_msg] No IMPF configuration field found in prologue.
[DEBUG: 2019-06-26 17:15:01 : hrit_msg] Computing actual satellite position
[DEBUG: 2019-06-26 17:15:01 : satpy.composites] Looking for composites config file seviri.yaml
[DEBUG: 2019-06-26 17:15:02 : satpy.composites] Looking for composites config file visir.yaml
[DEBUG: 2019-06-26 17:15:03 : hrit_msg] Calibration time 0:00:00.032823
[DEBUG: 2019-06-26 17:15:03 : hrit_msg] Calibration time 0:00:00.030742
[DEBUG: 2019-06-26 17:15:04 : hrit_msg] Calibration time 0:00:00.030735
[DEBUG: 2019-06-26 17:15:04 : satpy.resample] Could not add 'crs' coordinate with pyproj<2.0
[DEBUG: 2019-06-26 17:15:04 : satpy.scene] Setting 'PPP_CONFIG_DIR' to '/home/cpeters/satpy'
[DEBUG: 2019-06-26 17:15:04 : satpy.readers] Reading ['/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/satpy/etc/readers/generic_image.yaml', '/home/cpeters/satpy/readers/generic_image.yaml']
[DEBUG: 2019-06-26 17:15:04 : satpy.readers.yaml_reader] Assigning to generic_image: ['/mnt/nfs/rumo/20181001_1200_Meteosat-11_euro4_overview.png']
[DEBUG: 2019-06-26 17:15:04 : rasterio.env] Entering env context: <rasterio.env.Env object at 0x7f56a5069128>
[DEBUG: 2019-06-26 17:15:04 : rasterio.env] Starting outermost env
[DEBUG: 2019-06-26 17:15:04 : rasterio.env] No GDAL environment exists
[DEBUG: 2019-06-26 17:15:04 : rasterio.env] New GDAL environment <rasterio._env.GDALEnv object at 0x7f56a5069cc0> created
[DEBUG: 2019-06-26 17:15:04 : rasterio._env] GDAL_DATA found in environment: '/home/cpeters/anaconda2/envs/pytroll/share/gdal'.
[DEBUG: 2019-06-26 17:15:04 : rasterio._env] PROJ_LIB found in environment: '/home/cpeters/anaconda2/envs/pytroll/share/proj'.
[DEBUG: 2019-06-26 17:15:04 : rasterio._env] Started GDALEnv <rasterio._env.GDALEnv object at 0x7f56a5069cc0>.
[DEBUG: 2019-06-26 17:15:04 : rasterio.env] Got a copy of environment <rasterio._env.GDALEnv object at 0x7f56a5069cc0> options
[DEBUG: 2019-06-26 17:15:04 : rasterio.env] Entered env context: <rasterio.env.Env object at 0x7f56a5069128>
/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/rasterio/init.py:216: NotGeoreferencedWarning: Dataset has no geotransform set. The identity matrix may be returned.
s = DatasetReader(path, driver=driver, **kwargs)
[DEBUG: 2019-06-26 17:15:04 : rasterio._base] Nodata success: 0, Nodata value: -10000000000.000000
[DEBUG: 2019-06-26 17:15:04 : rasterio._base] Nodata success: 0, Nodata value: -10000000000.000000
[DEBUG: 2019-06-26 17:15:04 : rasterio._base] Nodata success: 0, Nodata value: -10000000000.000000
[DEBUG: 2019-06-26 17:15:04 : rasterio._base] Nodata success: 0, Nodata value: -10000000000.000000
[DEBUG: 2019-06-26 17:15:04 : rasterio._base] Dataset is started.
[DEBUG: 2019-06-26 17:15:04 : rasterio.env] Exiting env context: <rasterio.env.Env object at 0x7f56a5069128>
[DEBUG: 2019-06-26 17:15:04 : rasterio.env] Cleared existing <rasterio._env.GDALEnv object at 0x7f56a5069cc0> options
[DEBUG: 2019-06-26 17:15:04 : rasterio._env] Stopped GDALEnv <rasterio._env.GDALEnv object at 0x7f56a5069cc0>.
[DEBUG: 2019-06-26 17:15:04 : rasterio.env] Exiting outermost env
[DEBUG: 2019-06-26 17:15:04 : rasterio.env] Exited env context: <rasterio.env.Env object at 0x7f56a5069128>
[DEBUG: 2019-06-26 17:15:04 : satpy.composites] Looking for composites config file images.yaml
[DEBUG: 2019-06-26 17:15:04 : satpy.composites] No composite config found called images.yaml
[DEBUG: 2019-06-26 17:15:04 : satpy.readers.yaml_reader] No coordinates found for DatasetID(name='image', wavelength=None, resolution=None, polarization=None, calibration=None, level=None, modifiers=())
[DEBUG: 2019-06-26 17:15:04 : satpy.readers.generic_image] Reading DatasetID(name='image', wavelength=None, resolution=None, polarization=None, calibration=None, level=None, modifiers=()).
Traceback (most recent call last):
File "make_msg3_static_day.py", line 190, in
global_scene.load([composite])
File "/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/satpy/scene.py", line 969, in load
keepables = self.generate_composites()
File "/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/satpy/scene.py", line 884, in generate_composites
return self._read_composites(nodes)
File "/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/satpy/scene.py", line 858, in _read_composites
self._generate_composite(item, keepables)
File "/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/satpy/scene.py", line 833, in _generate_composite
**self.attrs)
File "/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/satpy/composites/init.py", line 1415, in call
if img.area.ndim is None:
File "/home/cpeters/anaconda2/envs/pytroll/lib/python3.6/site-packages/xarray/core/common.py", line 179, in getattr
(type(self).name, name))
AttributeError: 'DataArray' object has no attribute 'area'

@djhoese I corrected my areas.yaml post (there was a copy/paste error, first `EPSG_4326:' was missing).

@pnuu
Copy link
Member

pnuu commented Oct 8, 2019

I found at least one bug, but after fixing that found another. But I'm working on this now.

@mraspaud mraspaud added this to the v0.17.1 milestone Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants