Closed hgordo closed 2 years ago
i think I am misinterpreting what pyresample can do, sorry for the noise on your github page! Thanks.
Based on your code I don't think there is anything you are doing that is out of the question. I'd be OK with reopening this (or just continuing the discussion with it closed).
I don't see anything super wrong in the code. It all looks correct at first glance. However, I'm wondering if your area description of your input is correct. You have the images from when you resampled the area definitions, how did you generate that? You can see the resampled area doesn't even cover Florida. But the not resampled data looks fine... :thinking: this is very strange. If you can provide more of the code for how you plotted the areas it would be appreciated.
Ah sorry, I just realized your code is the plotting of the grids with np.ones
.
I got it! Or at least I got something that made sense to me. Change your origin
to origin="upper"
. That fixed your code for me above. If your image data ends up looking wrong with this, then you may need to flip it in the Y direction data = data[::-1, :]
before resampling it. You could also flip the source area definition's Y extents, that should work too. My guess is your image data is flipped from what pyresample assumes which is typically that the first pixel of an array is the upper-left corner of the image.
hi, Indeed that fixed it! Thank you very much for the help and sorry again for bothering you. I hadn't figured out that the image data were indeed flipped in the Y direction. Clearly pyresample is now doing a great job.
Code Sample, a minimal, complete, and verifiable piece of code
Problem description
When resampling the area definitions in the above, I see results from
This is not obviously wrong, but I am axctually trying to regrid an inventory of ammonia emissions, which look like before regridding and after. I have included the code to read the data file, commented out, in my sample above. The file is available online but it is 860MB.
I am not sure if I am mis-using the software - apologies!
Expected Output
I expect the green area of 1 to cover Florida in the resampled output
Actual Result, Traceback if applicable
The resampled green area seems distorted, it doesn't cover Florida for example, if the Cartopy coastlines are right.
Versions of Python, package at hand and relevant dependencies
python 3.9.9 h62f1059_0_cpython conda-forge pyresample 1.22.3 py39hde0f152_0 conda-forge