Comments (10)
Please provide the size and extent you used.
from pyresample.
centerpt = np.array([6068126.51, 566285.63])
cellsize = scn['C07'].resolution
x_size = 100
y_size = 100
area_extent = ((centerpt[0]-(x_size/2.)*cellsize),(centerpt[1]-(y_size/2.)*cellsize),(centerpt[0]+(x_size/2.)*cellsize),(centerpt[1]+(y_size/2.)*cellsize))
proj_dict = utils.proj4_str_to_dict(projection)
area_def = geometry.AreaDefinition(area_id, description, proj_id, proj_dict, x_size, y_size, area_extent)
from pyresample.
I am using this file: OR_ABI-L1b-RadM1-M6C07_G17_s20200080815309_e20200080815378_c20200080815417.nc which is a date where the mesoscale 1 overlaps with my area.
from pyresample.
Try passing radius_of_influence=50000
to the .resample
call. My guess is this is so close to the edge of the geostationary disk that the default guessing isn't going to produce anything good.
Side note: There should be no need to use utils.proj4_str_to_dict
anymore. Just pass the string directly to the AreaDefinition as the projection.
from pyresample.
Thank you! I passed radius_of_influence=50000
into the resample call but it did not change anything. I also tried to make the area smaller. It does resample correctly if ,instead of using my area, I pass resampler='native', but then I cannot crop it to the desired area.
from pyresample.
I typed all of the below and then realized you said in your original post that the G17 radiance case was working for you? I'm confused now at what wasn't working. Anyway...
I tested a version of your original code with GOES-17 2022 data, but I used full disk because I had it on my machine already and I wanted to prove it wasn't some other part of the processing causing your issue.
So with full disk G17 data I see a proper image with:
centerpt = np.array([6068126.51, 566285.63])
cellsize = scn['C07'].resolution
x_size = 100
y_size = 100
area_extent = ((centerpt[0]-(x_size/2.)*cellsize),(centerpt[1]-(y_size/2.)*cellsize),(centerpt[0]+(x_size/2.)*cellsize),(centerpt[1]+(y_size/2.)*cellsize))
area_def = geometry.AreaDefinition("", "", "", projection, x_size, y_size, area_extent)
scn = Scene(reader="abi_l1b", filenames=glob("/data/satellite/abi/g17_2022061/OR_ABI-L1b-RadF-M6C07_G17_s20220611940321_e20220611949398_c20220611949428.nc"))
scn.load(["C07"])
cropscn = scn.resample(area_def)
cropscn["C07"].plot.imshow().figure.show()
I had looked up your file and I think you're right that that mesoscale on that date is in the location you specified (I think). My other guesses:
- You're specifying
calibration="radiance"
. Do you need that? If you don't, does it work without it? - I wonder if
.resolution
that you're using is somehow invalid for the version of Satpy you have or for the file you're using. I'm not sure that is possible given how the reader is configured but yeah... - The data might not actually be where we think it is.
from pyresample.
The G17 radiance full disk works for me, it is just with the mesoscale that I run into this problem.
I removed the calibration="radiance"
but that didn't change anything. I also checked the area extent to make sure I am within the image bounds.
If instead of using my defined area, I use resampler='native'
, it does work for Mesoscale.
from pyresample.
If you use pyproj and transform the input mesoscale extents to your target area definition's CRS you see the coordinates are way different than the extents you've specified:
In [19]: from pyproj import Transformer
In [20]: trans = Transformer.from_crs(src_area.crs, area_def.crs)
In [22]: trans.transform(src_area.area_extent[0], src_area.area_extent[1])
Out[22]: (705962.4980286012, 5109369.184016362)
In [23]: trans.transform(src_area.area_extent[2], src_area.area_extent[3])
Out[23]: (716941.0587718873, 7703772.140405564)
If I change the center point to something near the middle of these coordinates I get output when I do:
In [25]: centerpt = [710000.0, 6500000.0]
...: cellsize = scn['C07'].resolution
...: x_size = 100
...: y_size = 100
...: area_extent = ((centerpt[0]-(x_size/2.)*cellsize),(centerpt[1]-(y_size/2.)*cellsize),(centerpt[0]+(x_size/2.)*cellsize),(centerpt[1]+(y_size/2.)*cellsize))
...: area_def = geometry.AreaDefinition("", "", "", projection, x_size, y_size, area_extent)
In [26]: cropscn = scn.resample(area_def)
In [27]: cropscn["C07"].plot.imshow().figure.show()
from pyresample.
Let me know if this reveals something for you. I'm going to close this in the mean time.
from pyresample.
Thank you so much!! This was incredibly helpful!
from pyresample.
Related Issues (20)
- EWA resampling in 1.27 slows down four times than 1.26.1 HOT 69
- Refactor boundary creation logic
- area definition for a rotated pole coordinate system HOT 24
- Index Error when calling `boundary` with non full disk geos ara HOT 5
- Bug where boundary coordinates wrap around 180 degrees when geostationary AreaDefinition extends beyond 180 degrees HOT 7
- Upgrade to Cython 3.0 and check annotations
- Compatibility with libproj v9.3 HOT 23
- How should this warning be addressed? HOT 2
- Catch or fix pyproj UserWarning when loading an AreaDefinition from a netCDF/CF file HOT 1
- Make a Swath definition subclass for interpolated data HOT 4
- The finding of the optimal radius of influence makes assumption on the ordering of the dimensions in the longitude array HOT 4
- Wrong coordinates returned by `AreaDefintion.get_lonlats` for some projections in out-of-Earth locations HOT 6
- dump DynamicAreaDefinition to YAML
- errors in area definition should not be silently ignored HOT 1
- Remove Configobj as Dependency Due To Security Vulnerability and No Longer Maintaned HOT 5
- YAML area configuration does not allow to specify the dtype and dtype is ignored in equality comparisons HOT 6
- "resample_nearest" GEO swath to eqc has tiny periodic "glitch" in results HOT 1
- RuntimeWarning: invalid value encountered in divide x_2 = (-b__ - np.sqrt(discriminant)) / (2 * a__) HOT 3
- Error in SwathDefinition html representation if lon/lat arrays are dask arrays HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyresample.