Add reproject method to AreaDefinition
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Individuate AreaDefinition in pyresample.geometry e confrontatelo con l’esempio reproject_area fornito; esaminate innanzitutto la gestione esistente di CRS, estensione e risoluzione. Definite il completamento sulla base di un metodo che crei un nuovo AreaDefinition per un’altra proiezione, preservando l’estensione di origine e l’intento della risoluzione, e tenete conto dei casi indicati relativi a swath e input di proiezione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Feature Request
Is your feature request related to a problem? Please describe.
Sometimes I just want to reproject an AreaDefinition e.g. use a different projection but keep the extent and also use a resolution "close" to the source AreaDefinition. Even with all the helpers for creating AreaDefinitions this
is a little cumbersome and takes to much time especially if this is just needed "on-the-fly" (meaning not worth putting it into a yaml file to keep it around).
Describe the solution you'd like
It would be nice to have a reproject method which produces a new AreaDefinition with the given projection.
For use in our working group I created the following some time ago:
import pyproj
from pyresample import geometry
from pyresample.utils.proj4 import proj4_dict_to_str
def reproject_area(area, target_proj):
"""
Reprojects area to target projection
Createa a new area definition in the target projection
while keeping the geographic extent and spatial resolution
of the source area.
Parameters
----------
area : pyresample area definition
target_proj : proj dict
Returns
-------
area
Todo
----
- handling of area definitions based solely on lat/lon
e.g. swath areas
- allow other inputs for target_proj than proj4 dicts
"""
if type(area) == geometry.SwathDefinition:
return NotImplementedError("Areas of type swath are currently not supported!")
area_id = area.area_id
area_desc = area.name
pcs_id = target_proj["proj"]
target_crs = pyproj.CRS.from_proj4(proj4_dict_to_str(target_proj))
xmax, ymax, xmin, ymin = area.area_extent
transformer = pyproj.Transformer.from_crs(area.crs, target_crs, always_xy=True)
xx, yy = transformer.transform([xmin, xmax], [ymin, ymax])
target_extent = [xx[0], yy[0], xx[1], yy[1]]
area_res_x = (xmax - xmin) / area.x_size
area_res_y = (ymax - ymin) / area.y_size
target_size_x = abs(int((target_extent[2] - target_extent[0]) / area_res_x))
target_size_y = abs(int((target_extent[3] - target_extent[1]) / area_res_y))
return geometry.AreaDefinition(area_id, area_desc, pcs_id, target_proj, target_size_x, target_size_y, target_extent)
This currently does not support swath areas and it would be nice to accept other projection formats than proj4 dicts. Also depending on the source area projection handling of the resolution calculation might need some refinement.
Describe any changes to existing user workflow
None.
- Lingua principale
- Python
- Stelle
- 388
- Fork
- 102
- Merge medio
- 5g 17h
- PR unite (30g)
- 5
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di pytroll/pyresample
-
Geometry `__eq__` and `__hash__` violate Python's hash/equality contractForse di nuovo libera @pnuu l’ha presa 44 giorni fa e non c’è nessuna pull request aperta. Apertabug Priority-Medium
pytroll/pyresample#745 · 1 commento · 3 assegnatari ·
-
Improve resampler x/y coordinate metadataForse di nuovo libera @djhoese l’ha presa 63 giorni fa e non c’è nessuna pull request aperta. Apertabug
pytroll/pyresample#739 · 1 assegnatario ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
pytroll/pyresample#698 · 1 commento ·
-
`AreaDefinition.get_area_slices` doesn't work for cropped geostationary areas like SEVIRI RSSAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
pytroll/pyresample#694 · 5 commenti ·
-
gradient_search comb effectForse di nuovo libera @mraspaud l’ha presa 383 giorni fa e non c’è nessuna pull request aperta. Aperta
pytroll/pyresample#682 · 7 commenti · 1 assegnatario ·
Tutte le issue di pytroll/pyresample
Issue simili
-
[Bug]: `hermes plugins update` clones an entire monorepo twice - `subdir` is resolved but dropped at both catalog-update call sitesForse già presa @HootRock l’ha presa oggi. Apertacomp/cli P2 type/perf
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
NousResearch/hermes-agent#142417 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug enhancement python
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
DewaldOosthuizen/tech-cheat-sheets-and-notes#392 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
bug p2
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Restore postgresql_vm_test_charm actions.yaml change (removed in canonical/postgresql-operator#2054)Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
canonical/postgresql-single-kernel-library#390 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni