Comments (4)
Related: #476
and pytroll/satpy#2283
from pyresample.
I've been thinking about this a lot during the last couple of days, and I think the approach presented here is actually not optimal. Here is why:
First, I'm realizing that we have different ways of interpolating data, depending on the organisation of the tie point (gridded vs non-gridded), and the interpolator chosen. This means that we should have either a very versatile interpolated swath def class, that knows how to handle different interpolation types, or have a unified api for interpolation (which I think would be difficult in the first place, just because of the different use cases).
Second, in my experience, the only case we need to interpolate a subset of the full lon/lats arrays is just to create a granule/swath boundary/ring/footprint.
Third, there is another use case for keeping track of the tie points, and that is to be able to save the inside a geotiff image (mentioned in #476). For this use case, the gcps could just be an attribute of the new class.
So a simpler solution in my opinion is to let the developer/user use relevant interpolator for its use case, and provide the corresponding dask array.
To develop, I have to go in satpy territory here, but I think it's necessary to see the bigger picture.
Most of the data we are using in satpy/pytroll provides a lot of metadata, among which the boundary/ring/footprint is provided. IMO, this should be the primary source, instead of computing it. For the data that don't have this data and where the geolocation is provided as tie points, I believe it is best to let the reader of that data determine the best/simplest way to compute the boundary (eg maybe it's as easy as passing the edge tiepoints, or maybe extrapolation is needed). Having a generic way would add a lot of unneeded complexity I think.
So, letting the dev of the reader take care of how to interpolate the data and how to find the boundary is I think the best option.
Hence, the solution I suggest now is:
- A new SwathDefinition subclass that contains a precomputed boundary
- A new SwathDefinition subclass that contains gcps
- ...or mixins...
from pyresample.
I think the missed use case here is someone who wants to use numpy arrays without dask involved. Obviously that's not our use case anymore as Satpy developers/users. But I think it is still something to keep in mind.
I haven't re-read the original post, but I remember it being mentioned somewhere that the swath definition could take a callback/interpolator. I guess this would be what you mentioned with:
have a unified api for interpolation (which I think would be difficult in the first place, just because of the different use cases)
But I mean anything can be a callback with two inputs (lons, lats), right? Not that I want to program this myself, but it would be an option that I'm not completely against if it provides something useful...
I think a restructured SwathDefinition like the one I'd like in Pyresample 2.0 with defined interfaces (via Protocols) could mean that someone wanting to do what you originally requested wouldn't have that hard of a time doing it. If we broke down the use cases of the SwathDefinition into .coords
, .boundary
, etc then anyone could make their own class as long as they implemented these things. The object wouldn't even have to be created with SwathDefinition as a base class.
Bottom line: I'm OK not implementing a specialized class that does the interpolation. I just wanted to point out the solutions for it that I'm not completely against.
from pyresample.
Thanks for reminding me of that this use case. It is of course valid, but I think it will be a third subclass/mixin then.
from pyresample.
Related Issues (20)
- BUG: Import fails due to misconfigured setup.py HOT 3
- Infinite values in geostationary bounding box crash intersection function HOT 2
- resampling fails with `ValueError` if not padding data HOT 2
- Time for spherical intersection almost doubled in recent version of pyresample
- `get_neighbour_info` slows down significantly when working with large target rasters using many segments HOT 3
- `gradient_search` fails when resampling Himawari data HOT 7
- 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
- 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
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.