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

Mimic TPW Reader #858

Merged
merged 39 commits into from Dec 26, 2019
Merged

Mimic TPW Reader #858

merged 39 commits into from Dec 26, 2019

Conversation

joleenf
Copy link
Contributor

@joleenf joleenf commented Jul 16, 2019

Mimic TPW reader for files from SSEC, reads both the coarse and fine scale equirectangular grids produced. Addresses #807

  • Attempts to close Add a MIMIC-TPW2 reader #807
  • Passes flake8 satpy No - Weird error that I cannot figure out... "flake8-docstrings" failed during execution due to "module 'pydocstyle' has no attribute 'tokenize_open'" Run flake8 with greater verbosity to see more details.

I ran flake8 with doctstrings extension and could not reproduce outside of pre-commit environment.

…t. Add tpwGrid to yaml because

          the automatic detection is not adding the tpwGrid variable to the handled_variables outside of
          debugging mode in pycharm.  This is still not a model of code to follow.
"Fix" the area definition, because the data is in degrees and needs longlat projection from Proj4
but I am not sure if that was the only thing wrong.
…oarse and fine mimic files

Since the mimic files for the coarse and fine resolution are named exactly the same, errors and failure
result when data variables are described in yaml.  Follow TommyJ approach to extracting any
data variable that matches navigation shape.  This then smoothly reads all the variables in
the coarse resolution files, while still being able to read the single tpwGrid variable in the fine
resolution files.  The coordinates of 'latitude', 'longitude' were returing datasetID errors and
were removed from the new_info update for the tpw variables
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 83.561% when pulling 17473ab on joleenf:mimic into cc6ba42 on pytroll:master.

@coveralls
Copy link

coveralls commented Jul 16, 2019

Coverage Status

Coverage increased (+0.004%) to 87.387% when pulling 4fd2c32 on joleenf:mimic into 73e081f on pytroll:master.

@codecov
Copy link

codecov bot commented Jul 16, 2019

Codecov Report

Merging #858 into master will increase coverage by 0.02%.
The diff coverage is 88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #858      +/-   ##
==========================================
+ Coverage   87.36%   87.39%   +0.02%     
==========================================
  Files         185      188       +3     
  Lines       28446    28621     +175     
==========================================
+ Hits        24853    25012     +159     
- Misses       3593     3609      +16
Impacted Files Coverage Δ
satpy/enhancements/mimic.py 0% <0%> (ø)
satpy/tests/reader_tests/__init__.py 98.41% <100%> (+0.02%) ⬆️
satpy/readers/mimic_TPW2_nc.py 90% <90%> (ø)
satpy/tests/reader_tests/test_mimic_TPW2_nc.py 92.04% <92.04%> (ø)
satpy/scene.py 90.45% <0%> (+0.17%) ⬆️
satpy/readers/__init__.py 94.56% <0%> (+1.2%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 73e081f...4fd2c32. Read the comment docs.

@joleenf
Copy link
Contributor Author

joleenf commented Jul 24, 2019

I cannot resample using the built-in scn.resample() method. I think there must be something wrong with the way the data is being loaded. I need to look into this.

@joleenf
Copy link
Contributor Author

joleenf commented Jul 24, 2019

Re-open and just try to fix the problem with the pull request open.

@joleenf joleenf reopened this Jul 24, 2019
@joleenf
Copy link
Contributor Author

joleenf commented Jul 31, 2019

That is an interesting question, it is an addition I made before finding out that the resampling issue was due to the area_of_influence setting in resample. I looked more closely at why I thought it was a keyword. It can be included in certain AreaDefinitions from certain methods (I think) but may not be appropriate here. When I first wrote the code in that section, I was thinking that the grid spacing of the longlat proj would be inferred... Here is the documentation that included resolution, but looking at it closer, it might be the wrong doc again: https://pyresample.readthedocs.io/en/stable/geometry_utils.html#areadefinition-creation In particular, it does not accept a tuple resolution as documented.

@djhoese
Copy link
Member

djhoese commented Jul 31, 2019

That is for the create_area_def function, you are calling AreaDefinition directly, but more importantly you added the resolution to the proj_dict and not the AreaDefinition keyword arguments.

@djhoese
Copy link
Member

djhoese commented Sep 27, 2019

@joleenf Could you merge this with master again to see if the tests pass?

@joleenf
Copy link
Contributor Author

joleenf commented Oct 1, 2019

@djhoese How would I merge this again? I have a message that "Merging is blocked." I am not authorized.

@mraspaud mraspaud added component:readers enhancement code enhancements, features, improvements labels Oct 24, 2019
@mraspaud
Copy link
Member

How does it look now ? Are we ready to merge @joleenf @djhoese ?

Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for adding this new reader for precip products !
Could you just add the test suite to the master suite for readers in satpy/tests/reader_tests/__init__.py ?

@djhoese
Copy link
Member

djhoese commented Oct 25, 2019

Tests failing with:

======================================================================

ERROR: test_load_mimic (satpy.tests.reader_tests.test_mimic_TPW2_nc.TestMimicTPW2Reader)

Load Mimic data

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/home/travis/build/pytroll/satpy/satpy/tests/reader_tests/test_mimic_TPW2_nc.py", line 137, in test_load_mimic

    ds = r.load(['tpwGrid'])

  File "/home/travis/build/pytroll/satpy/satpy/readers/yaml_reader.py", line 843, in load

    ds = self._load_dataset_with_area(dsid, coords)

  File "/home/travis/build/pytroll/satpy/satpy/readers/yaml_reader.py", line 749, in _load_dataset_with_area

    area = self._load_dataset_area(dsid, file_handlers, coords)

  File "/home/travis/build/pytroll/satpy/satpy/readers/yaml_reader.py", line 731, in _load_dataset_area

    return self._load_area_def(dsid, file_handlers)

  File "/home/travis/build/pytroll/satpy/satpy/readers/yaml_reader.py", line 655, in _load_area_def

    area_defs = [fh.get_area_def(dsid) for fh in file_handlers]

  File "/home/travis/build/pytroll/satpy/satpy/readers/yaml_reader.py", line 655, in <listcomp>

    area_defs = [fh.get_area_def(dsid) for fh in file_handlers]

  File "/home/travis/build/pytroll/satpy/satpy/readers/mimic_TPW2_nc.py", line 137, in get_area_def

    area_def = AreaDefinition(area_id, description, proj_id, proj_dict, width, height, area_extent, )

  File "/home/travis/miniconda/envs/test/lib/python3.7/site-packages/pyresample/geometry.py", line 1042, in __init__

    self.crs = CRS(projection)

  File "/home/travis/miniconda/envs/test/lib/python3.7/site-packages/pyproj/crs.py", line 303, in __init__

    super(CRS, self).__init__(projstring)

  File "pyproj/_crs.pyx", line 1335, in pyproj._crs._CRS.__init__

pyproj.exceptions.CRSError: Invalid projection: +proj=longlat +datum=WGS84 +ellps=WGS84 +units=degrees +type=crs: (Internal Proj Error: proj_create: Error -7: unknown unit conversion id)

I don't think +units=degrees is a thing in all versions of PROJ.

@mraspaud mraspaud merged commit 5ce2122 into pytroll:master Dec 26, 2019
@joleenf joleenf deleted the mimic branch May 19, 2021 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:readers enhancement code enhancements, features, improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a MIMIC-TPW2 reader
4 participants