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

cdsapi retrieval helper #17

Open
hsteptoe opened this issue Apr 9, 2020 · 0 comments
Open

cdsapi retrieval helper #17

hsteptoe opened this issue Apr 9, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@hsteptoe
Copy link

hsteptoe commented Apr 9, 2020

Description

A new function to help populate fields within the cdsapi retrieve() function. Mainly to make dealing with date ranges quicker. The function would take a from and to date, and options to specify variables and time interval (frequency). This could be extended to use dask for parallel retrievals.

Example syntax

VARS = ['10m_u_component_of_wind', '10m_v_component_of_wind']
getera5(from='2019-05-23', to='2019-05-30', var=VARS, freq='H')

or for a parallel version

FROMS=['2019-05-23', '2008-12-25']
TOS = ['2019-05-30', '2009-01-05']
VARS = ['10m_u_component_of_wind', '10m_v_component_of_wind']
getera5(from=FROMS, to=TOS, var=VARS, freq='H')

to retrieve different time means for the same period

getera5(from=['2019-05-23', '2019-05-23'], to= ['2019-05-30', '2019-05-30'], 
        var=VARS, freq=['H', 'M'])

Notes

  • In the case of multiple retrievals, the function would assume that the same VARS are retrieved in each case. I can't particularly see a use case where different vars would be wanted for different time periods within code relating to one project...
  • Dependencies: pandas to deal with date range wrangling
  • I'd suggest sticking with the pandas frequency aliases: https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#timeseries-offset-aliases
  • Need to consider what other args might be need to facilitate the full range of cdsapi retrievals
@zmaalick zmaalick added the enhancement New feature or request label May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants