MetOffice / MetOffice/CATNIP

cdsapi retrieval helper

Open
#17 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
HTML
Stars
5
Forks
2
PR merge metrics
No merged PRs in 30d

Description

## 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
```python
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
```python
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
```python
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

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing cdsapi retrieval integration and its current retrieve() entry point. Compare its supported arguments with the proposed getera5 inputs for date ranges, variables, and frequency, then define how multiple retrievals should be represented. Done means the helper handles the requested examples and has coverage for its date and frequency behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.