-
Notifications
You must be signed in to change notification settings - Fork 44
Support searching ESGF for a specific version of a file #1822
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1822 +/- ##
==========================================
+ Coverage 91.54% 91.57% +0.02%
==========================================
Files 203 203
Lines 10945 10979 +34
==========================================
+ Hits 10020 10054 +34
Misses 925 925
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
valeriupredoi
left a comment
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.
(possible) changes requested, depending on what @bouweandela thinks of my comment; otherwise the code and functionality, inc tests look great. Just remember to add to the documentation of course, but am guessing that'll happen in #1609
Documentation for the new features introduced here should be included in this pull request. I did add some docs, is there anything you're missing? |
yes, an example where a specific version of the file is requested - I didn't see it in the docs (not the API documentation, but rather, the actual doc where esgf stuff is documented) |
|
@bouweandela you may also want to close this #1523 too after this gets merged |
|
That's a different problem, not solved in this pull request. It might be best to solve that after we have a similar interface for searching for files locally as proposed in #1825 because if the files on ESGF have different timespans than the ones available locally, it will still cause trouble even if fixed for one of the two search methods. |
|
@valeriupredoi I added some more examples to explain the functionality better. Could you have another look, please? |
valeriupredoi
left a comment
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.
purrfect, cheers @bouweandela 🍺
|
@ESMValGroup/technical-lead-development-team this is good for merge, any of you good folk want to have a last look and merge it, please? 🍺 |
schlunma
left a comment
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.
Looks good to me!
Just two small questions on the code and one general one: has this been tested with real recipes? I think it would be good to test some recipes (with offline=False) with that to make sure nothing broke (at least one that uses timerange, one that uses start_date/end_date, and one that uses wildcards in timerange). I guess this does not allow to use version in the recipe yet?
Cheers! 🚀
That will probably only work when getting all data from ESGF. Support for doing that with local data is implemented in #1835. |
@valeriupredoi Did you already have a go at this? I just did it myself and everything seems fine, but it's probably best done by someone else than the author of the changes. |
no I didn't - but the tests are nice and all-inclusive, I don't see any problem with running it. Would you still want me to run tests? I'd rather do it when we already have an example in ESMValTool 😁 |
Yes, I think that's what @schlunma just asked for. Here is a (slightly modified in the time selection part) version of the example Python recipe that I just used for testing: # ESMValTool
# recipe_python.yml
---
documentation:
description: |
Example recipe that plots a map and timeseries of temperature.
title: Recipe that runs an example diagnostic written in Python.
authors:
- andela_bouwe
- righi_mattia
maintainer:
- schlund_manuel
references:
- acknow_project
projects:
- esmval
- c3s-magic
datasets:
- {dataset: BCC-ESM1, project: CMIP6, exp: historical, ensemble: r1i1p1f1, grid: gn}
- {dataset: CanESM2, project: CMIP5, exp: historical, ensemble: r1i1p1}
preprocessors:
select_january:
extract_month:
month: 1
convert_units:
units: degree_Celsius
annual_mean_amsterdam:
extract_point:
latitude: 52.379189
longitude: 4.899431
scheme: linear
annual_statistics:
operator: mean
multi_model_statistics:
statistics:
- mean
span: overlap
annual_mean_global:
area_statistics:
operator: mean
fx_variables:
areacella:
annual_statistics:
operator: mean
diagnostics:
map:
description: Global map of temperature in January 2000.
themes:
- phys
realms:
- atmos
variables:
tas:
mip: Amon
preprocessor: select_january
start_year: 2000
end_year: 2000
scripts:
script1:
script: examples/diagnostic.py
quickplot:
plot_type: pcolormesh
cmap: Reds
timeseries:
description: Annual mean temperature in Amsterdam and global mean since 1850.
themes:
- phys
realms:
- atmos
variables:
tas_amsterdam:
short_name: tas
mip: Amon
preprocessor: annual_mean_amsterdam
timerange: '*'
tas_global:
short_name: tas
mip: Amon
preprocessor: annual_mean_global
timerange: '1850/2000'
scripts:
script1:
script: examples/diagnostic.py
quickplot:
plot_type: plot |
... Cheers, bud! Works very well 🍻 |
|
Awesome, thanks very much both! Will merge now 🚀 |
|
great work, chaps! |
Description
This adds support to
esmvalcore.esgf.find_filesfor searching for a specific version of a file on ESGF. This a prerequisite to support specific versions of datasets in the recipe, which is part of #1609. It also adds anesmvalcore.esgf.ESGFFile.facetsattribute, which can be used to inspect the facets of theESGFFile.Example usage:
result
and
result:
Link to documentation: https://esmvaltool--1822.org.readthedocs.build/projects/ESMValCore/en/1822/api/esmvalcore.esgf.html
Before you get started
Checklist
It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.
To help with the number pull requests: