-
Notifications
You must be signed in to change notification settings - Fork 300
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
Automatic list with overviews of inlcuded area definitions for the documentation #2167
Automatic list with overviews of inlcuded area definitions for the documentation #2167
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2167 +/- ##
==========================================
+ Coverage 95.91% 95.94% +0.02%
==========================================
Files 366 366
Lines 53504 53504
==========================================
+ Hits 51321 51332 +11
+ Misses 2183 2172 -11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This looks interesting. How easy would it be for users to use this feature to generate overviews of areas from their own local YAML files? |
doc/source/area_def_list.py
Outdated
def generate_area_def_list(): | ||
"""Create list of available area definitions with overview plot. | ||
|
||
Returns: | ||
str | ||
""" | ||
area_list = [] | ||
|
||
template = ("{area_name}\n" | ||
"{n:->{header_title_length}}\n\n" | ||
".. raw:: html\n\n" | ||
"{content}\n\n" | ||
" <hr>\n\n") | ||
|
||
area_file = get_area_file()[0] | ||
for aname in list(_read_yaml_area_file_content(area_file).keys()): | ||
area = get_area_def(aname) | ||
if hasattr(area, "_repr_html_"): | ||
content = "\n".join([x.rjust(len(x) + 5) for x in area_repr(area, include_header=False).split("\n")]) | ||
area_list.append(template.format(area_name=aname, n="", header_title_length=len(aname), | ||
content=content)) | ||
else: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this function rather belong to pyresample?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it doesn't really make sense to include in in pyresample because there is no area definition yaml included and this is only useful to generate a rst with a list of area definitions for the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is true that pyresample does not have a default yaml file, but it is pyresample that contains all the functions for reading such yaml files. And also, I would argue that for the sake of separation of concerns, it should be included there.
In practice, I wouldn't be against having a default yaml file with a few generic areas in pyresample by the way, that would probably help potential pyresample users in the future...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't areas.yaml
fit better with pyresample entirely? But pyresample does not have a concept of SATPY_CONFIG_PATH
or a config directory search, so it wouldn't know where to find areas.yaml
anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that anyone asked for my opinion, but I agree with wanting this in pyresample. I'm not a big fan of a default set of areas in pyresample except only as a few examples (like global lon/lat, one LCC, one polar-stereographic, etc)...generic areas. Pyresample is the low-level functionality, but it doesn't know anything about satellite-specific areas or that it is used for "science" at all so to me it is a fine line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A while ago, I found a small list of generic areas, like europe, north and south america, etc. I'll try to find it again, so we can use that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I see, those are just area names without defining anything AreaDefinition
y that we could use.
@gerritholl Curently not that easy I guess. But could easily be refactored to be available to users I think. |
Especially if it was in pyresample 😉 |
@mraspaud @gerritholl ok so where should this go in pyresample? Should I include it in pytroll/pyresample#450 or make a separate PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. A screenshot would be nice :-)
There are some problems with building the documentation, but they seem to be because pytroll/pyresample#450 needs to be merged and released first. |
Yes correct. Based on some discussions and ideas I had I am working on making this more useable/pretty so please wait with merging this even if pytroll/pyresample#450 gets merged in the meantime. |
Since there are quite a few Below you can see how it would look like. One think to note is that all the area definitions also appear in the toc tree which is not a huge deal but not that nice I guess. I think that has something to do with the toc maxdepth setting but I couldn't get that fixed somehow. So if somebody has an idea about that please share. Apart from that I notice that there are two area definitions I think belong to
|
Just as a reminder for whoever is looking for a status update, this is waiting for completion of pytroll/pyresample#450 |
Pull Request Test Coverage Report for Build 9483462883Details
💛 - Coveralls |
pytroll/pyresample#450 is now merged. Do we need a pyresample release before this can work? |
I think so because if I see correctly read the docs uses a conda installed pyresample to build the docs. |
You can add yourself to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be merged, thanks for the adding it. The filling for water bodies is not always working, but that needs to be fixed in pyresample.
Based on pytroll/pyresample#450 this generates overviews for all
AreaDefinitions
included with Satpy and adds them to the resampling section.I noticed that a quite large number of
AreaDefinitions
are included which make the section really long now.Some areas are not included because only
AreaDefinitions
currently have_repr_html_
(see PR above).