pytroll / satpy

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

Reprojected image cut off at 180E #3000

Open crazyapril opened 6 days ago

crazyapril commented 6 days ago

Describe the bug I have a flat night light map (in EPSG:4326), and I want to reproject it to a satellite view. However, the reprojected image gets cut off at 180E. Obviously it's not wanted. image

What could go wrong?

To Reproduce

from satpy.resample import get_area_def
from satpy.scene import Scene

blackmarble = Scene(reader="generic_image",
                    filenames=["recipes/BlackMarble.tiff"])
blackmarble.load(["image"])
res = blackmarble.resample(get_area_def("himawari9"), resampler="nearest")
res.save_dataset("image", "recipes/h9-night.tif", writer="geotiff")

And area def himawari9:

himawari9:
  description: Himawari-9 B03
  projection:
    proj: geos
    lon_0: 140.7
    h: 35785863
    x_0: 0
    y_0: 0
    a: 6378137
    rf: 298.257024882273
    no_defs: null
    type: crs
  shape:
    height: 22000
    width: 22000
  area_extent:
    lower_left_xy: [-5499999.968358421, -5499999.96835842]
    upper_right_xy: [5499999.968358421, 5499999.968358421]
    units: m
djhoese commented 6 days ago

I'm surprised by your results, but more than likely this would be helped by the work described here:

https://github.com/pytroll/pyresample/issues/627

I just haven't had the time lately to play around with it. Sorry.

crazyapril commented 5 days ago

I added pm: 180 into the area def and got this: image

Maybe we need more tweaks? And when I changed lon_0 to -39.3 I just got the same result with the initial one.

pnuu commented 5 days ago

Try adding reduce_data=False to the .resample() call in your original code.

crazyapril commented 4 days ago

My original map is exceptionally large (40,000x20,000), and adding reduce_data=False causes my 128GB of memory to be completely used up. I can confirm it works for smaller maps, but I’m wondering if there’s a way to handle this using just satpy.