Statistics: to use for solar radiation AgERA5

Using python to download (via cdsapi) AgERA5 data from Agrometeorological indicators from 1979 to present derived from reanalysis , “statistic”: [“24_hour_mean”] can used for several variables but for “solar_radiation_flux” as it is a daily accumulation I assume (and there is no “24_hour_sum” option). Can I set “statistic”: to something else (nothing?) so it don’t mess up the script ( as the same script is used for different variables). I tried “statistic”: [“”] but I do not work. Suggestions?

Example without “statistic”:

import cdsapi

dataset = “sis-agrometeorological-indicators”
request = {
“variable”: “solar_radiation_flux”,
“year”: [“1979”],
“month”: [“01”],
“day”: [“01”],
“version”: “2_0”,
“area”: [90, -180, -90, 180]
}

client = cdsapi.Client()
client.retrieve(dataset, request).download()

Example with “statistic”:

import cdsapi

dataset = "sis-agrometeorological-indicators"
request = {
    "variable": "vapour_pressure",
    "statistic": ["24_hour_mean"],
    "year": ["1979"],
    "month": ["01"],
    "day": ["01"],
    "version": "2_0",
    "area": [90, -180, -90, 180]
}

client = cdsapi.Client()
client.retrieve(dataset, request).download()

Thanks

/Jonas

It works for me with ”statistic” left out, as in your first example. Or are you asking if you can have ”statistic: <something>” so that you can keep the same dictionary structure everywhere?

The way I’ve set my code up is to have a base dictionary that contains the year/month/day, area, etc. and then I create separate dictionaries for variables, e.g.:

import cdsapi

dataset = "sis-agrometeorological-indicators"
request_main = {
    "year": ["1979"],
    "month": ["01"],
    "day": ["01"],
    "version": "2_0",
    "area": [90, -180, -90, 180]
}

request_temperature_min = {
    "variable": "2m_temperature",
    "statistic": ["24_hour_minimum"],
} | request_main

request_irradiation = {
    "variable": "solar_radiation_flux",
} | request_main

client = cdsapi.Client()
client.retrieve(dataset, request_temperature_min).download()
client.retrieve(dataset, request_irradiation).download()

(with earthkit-data you can pass the requests to the download function in one go, which is even more convenient: earthkit.data.from_source(“cds”, dataset, request_temperature_min, request_irradiation))