pytroll / pytroll/pyresample

Catch or fix pyproj UserWarning when loading an AreaDefinition from a netCDF/CF file

Open
#550 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
385
Forks
102
Avg merge
4d 2h
Merged PRs (30d)
9

Description

What's the problem:

pyresample's load_cf_area() forwards a UserWarning from pyproj:
UserWarning: You will likely lose important projection information when converting to a PROJ string from another format.

Severity:

Low. It is annoying to get the warning, but we know where it comes from.

Where does it come from:
The warning is triggered because we call pyproj's CRS.to_dict():
https://github.com/pytroll/pyresample/blob/c0025ed8905cb8d026de4b3a48451346b802b36c/pyresample/utils/cf.py#L66

We use CRS.to_dict() to test the type of the projection, not to do any math / transformation with it.

Solutions:
Two solutions:

  1. Keep using to_dict() but catch the UserWarning (as done elsewhere in pyresample);
  2. Access the parameters in another, more CRS-friendly way, that will not trigger a warning.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at pyresample/utils/cf.py around line 66 and follow load_cf_area(), where CRS.to_dict() triggers the pyproj UserWarning. Review how warning handling is done elsewhere in pyresample and compare the two proposed approaches. Done means loading an AreaDefinition from a netCDF/CF file without the warning while preserving the projection-type check.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.