Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How should this warning be addressed? #547

Closed
yhyxzx opened this issue Oct 11, 2023 · 2 comments · Fixed by #548
Closed

How should this warning be addressed? #547

yhyxzx opened this issue Oct 11, 2023 · 2 comments · Fixed by #548
Assignees

Comments

@yhyxzx
Copy link

yhyxzx commented Oct 11, 2023

Code Sample, a minimal, complete, and verifiable piece of code

projection = '+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'
area_def_therm = get_area_def(area_id, description, proj_id, projection, patch_size_m / 1000, patch_size_m / 1000, \
                                      area_extent)

Problem description

D:\anaconda3\envs\NewsstsrPredata\lib\site-packages\pyproj\crs\crs.py:1293: UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
proj = self._crs.to_proj4(version=version)

@djhoese
Copy link
Member

djhoese commented Oct 11, 2023

Short answer: Don't use get_area_def, just create an AreaDefinition yourself with:

from pyresample.geometry import AreaDefinition
area_def_therm = AreaDefinition(...)

Long answer:

The get_area_def function is there for historical reasons. It uses a conversion from a PROJ.4 string to a PROJ.4 dictionary of parameters which results in the warning you're seeing. That conversion is no longer needed as pyresample's AreaDefinition now depends on pyproj's CRS object which can take many common ways of describing a projection and have it "just work" and with no warning. I'm 99% sure I can remove that conversion from that function and no user would notice a problem.

Second long answer: You could also use the create_area_def (create_ versus get_) which allows for different variations of parameters and will "do the math" for you to create the area you're trying to describe. For example, you have the size of the pixels for the area you want to make and the number of pixels in that area, but you don't want to calculate the extents. create_area_def will accept the information you have and compute any values it needs from that information.

I will plan on making a PR to remove that conversion in get_area_def, but as I said creating your AreaDefinition directly should work just as well (better in fact).

@yhyxzx
Copy link
Author

yhyxzx commented Oct 12, 2023

Thank you for your patient response!

@yhyxzx yhyxzx closed this as completed Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants