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

Harmonise AreaDefinition namings in EUM geos readers and sort geos areas in areas.yaml #1485

Merged
merged 30 commits into from Dec 16, 2020

Conversation

ameraner
Copy link
Member

@ameraner ameraner commented Dec 14, 2020

This PR contributes to #1248 by standardizing the way AreaDefinition's area_id, description and proj_id are returned in geostationary data readers of EUMETSAT data (L1 SEVIRI and FCI).
It follows the convention <platform>_<instrument>_<service>_<resolution> for the area_id. A generic formatting function get_geos_area_naming is implemented in _geos_area.

New standard areas for SEVIRI and FCI are added to areas.yaml.

It also starts the work on #819 by sorting the geostationary areas.
Changes "globe" to "disk" in area descriptions to close #1187.

  • Tests added
  • Passes flake8 satpy
  • Fully documented

@ameraner ameraner changed the title Harmonise AreaDefinition namings in EUM geos readers and add new and sort geos areas in areas.yaml Harmonise AreaDefinition namings in EUM geos readers and sort geos areas in areas.yaml Dec 14, 2020
@codecov
Copy link

codecov bot commented Dec 14, 2020

Codecov Report

Merging #1485 (c2f56cd) into master (45843de) will increase coverage by 0.00%.
The diff coverage is 94.59%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1485   +/-   ##
=======================================
  Coverage   90.87%   90.88%           
=======================================
  Files         241      241           
  Lines       35113    35173   +60     
=======================================
+ Hits        31908    31966   +58     
- Misses       3205     3207    +2     
Flag Coverage Δ
behaviourtests 4.48% <0.00%> (-0.01%) ⬇️
unittests 91.35% <94.59%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
satpy/readers/seviri_base.py 95.18% <ø> (-0.09%) ⬇️
satpy/readers/seviri_l1b_nc.py 49.57% <20.00%> (-0.43%) ⬇️
satpy/readers/_geos_area.py 100.00% <100.00%> (ø)
satpy/readers/eum_base.py 73.46% <100.00%> (+2.35%) ⬆️
satpy/readers/fci_l1c_fdhsi.py 97.51% <100.00%> (+0.03%) ⬆️
satpy/readers/seviri_l1b_hrit.py 90.93% <100.00%> (+0.05%) ⬆️
satpy/readers/seviri_l1b_native.py 79.11% <100.00%> (-0.20%) ⬇️
satpy/tests/reader_tests/test_eum_base.py 100.00% <100.00%> (ø)
satpy/tests/reader_tests/test_geos_area.py 100.00% <100.00%> (ø)
satpy/tests/reader_tests/test_seviri_base.py 100.00% <100.00%> (ø)
... and 2 more

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 45843de...c2f56cd. Read the comment docs.

@ameraner ameraner marked this pull request as ready for review December 14, 2020 17:05
@ameraner ameraner requested a review from sjoro December 14, 2020 17:06
Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

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

Wow, so many changes. Nice job. Had a few small style questions and comments.

@@ -1,3 +1,212 @@
# This file contains a set of pre-defined areas to be used for resampling purposes.

# ----------------------------------------------------------------------------------------------------------------------
Copy link
Member

Choose a reason for hiding this comment

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

Thoughts on an 80 character limit for this file? There are ways in YAML to make multiline strings if we need to (for the area "description" if those get long.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have no opinion on this, so as you wish.

I guess we could go with:

  description: >-
    MSG SEVIRI Full Earth Scanning service
    area definition with 3 km resolution

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I just noticed that it was hard to read all the section headers because of how long they were. Could have been my browser window width or GitHub imposing a character/column limit.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done! Noticed that simply splitting the lines without the >- works the same (folding with a space, no end newline).

lower_left_xy: [-4823148.089050828, 1969764.6783588605]
upper_right_xy: [4178061.408400173, 5570248.477339261]

EastEurope:
Copy link
Member

Choose a reason for hiding this comment

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

Is this an area that existed before? If so, did it have the same name? Regardless, EastEurope, EuropeCanary, and SouthAmerica are pretty generic names for geostationary specific areas. Obviously, whatever amount of South America SEVIRI sees in its geostationary full disk isn't going to be the best for other datasets that are more "central" to South America.

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see now that these were old areas. Did we decide we'd come up with better names for these in a later PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, those are all old areas. And yes, I think another PR is needed for the general cleanup/renaming, and possibly adding a deprecation warning. For now, I relegated to deprecation only the old full-disk ones.

# ----------------------------------------------------------------------------------------------------------------------
# ------------------------------------------------ Areas to be deprecated ----------------------------------------------
# ----------------------------------------------------------------------------------------------------------------------
# This section contains areas that are obsolete.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible for satpy to issue a warning when someone uses an obsolete area name?

Copy link
Member

Choose a reason for hiding this comment

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

Not currently, but I think we could add it. The cases where someone does new_scn = scn.resample('obsolete_area') would be very easy to handle. The cases where someone is manually specifying a path to the areas.yaml file and requesting it might be harder since there are a few utilities doing that and most are in pyresample which doesn't know or care about the areas defined in satpy.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess yes, e.g. a check for deprecated areas could be placed in satpy.resample.get_area_def(), which is what is used to get the destination AreaDefinition out of the yaml when resampling... TBD in #819

Copy link
Member

@sfinkens sfinkens left a comment

Choose a reason for hiding this comment

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

Good work! Just one request: Since we discovered during the PCW that the SEVIRI Native area extent is slightly different from msg_seviri_fes_1/3km, I think it would be nice to mention that in NativeMSGFileHandler.get_area_def.

@ameraner
Copy link
Member Author

@sfinkens Thanks! Good idea, I added a notice in the native and netcdf readers get_area_def

Copy link
Collaborator

@sjoro sjoro 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 sorting this out and also for fixing the documentation weblinks!

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.

Looks like the changes in the seviri nc reader aren't covered, otherwise LGTM

satpy/etc/areas.yaml Outdated Show resolved Hide resolved
@mraspaud
Copy link
Member

Oh, also, proj_id should really be deprecated, so should we just set it to an empty value here instead?

@ameraner
Copy link
Member Author

@mraspaud I was wondering the same about the proj_id. I'm ok with setting it to empty and make things easier!

Regarding the NetCDF tests: yes the changes are not covered, because there's almost no test at all for the NetCDF reader. So I figured I would leave it for now, planning to add comprehensive tests in another dedicated PR. Is it ok?

@mraspaud
Copy link
Member

I'm ok with leaving the nc part uncovered for now.

Comment on lines +284 to +297
Note that the AreaDefinition area extents returned by this function for Native data will be slightly
different compared to the area extents returned by the SEVIRI HRIT reader.
This is due to slightly different pixel size values when calculated using the data available in the files. E.g.
for the 3 km grid:

``Native: data15hd['ImageDescription']['ReferenceGridVIS_IR']['ColumnDirGridStep'] == 3000.4031658172607``
``HRIT: np.deg2rad(2.**16 / pdict['lfac']) * pdict['h'] == 3000.4032785810186``

This results in the Native 3 km full-disk area extents being approx. 20 cm shorter in each direction.

The method for calculating the area extents used by the HRIT reader (CFAC/LFAC mechanism) keeps the
highest level of numeric precision and is used as reference by EUM. For this reason, the standard area
definitions defined in the `areas.yaml` file correspond to the HRIT ones.

Copy link
Member

Choose a reason for hiding this comment

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

Excellent, thanks!

Conflicts:
	satpy/readers/seviri_base.py
	satpy/readers/seviri_l1b_hrit.py
	satpy/readers/seviri_l1b_native.py
	satpy/readers/seviri_l1b_nc.py
@ameraner
Copy link
Member Author

@mraspaud added a commit that replaces all proj_id as empty strings and adds a note in the formatting function about the deprecation.

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

@mraspaud mraspaud merged commit 700ab42 into pytroll:master Dec 16, 2020
@ameraner
Copy link
Member Author

Thanks all for your help and discussions!

@mraspaud mraspaud added the enhancement code enhancements, features, improvements label Dec 16, 2020
@ameraner ameraner deleted the feature-harmonise_EUM_area_naming branch March 1, 2021 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement code enhancements, features, improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Areas claiming to view "full globe" should be labelled "full disk" instead
7 participants