AgrDataSci / ag5Tools

R toolbox to download and extract data from the "Agrometeorological indicators from 1979 to present derived from reanalysis" (AgERA5) dataset.
https://agrdatasci.github.io/ag5Tools/
Other
7 stars 6 forks source link

ag5_extract not locating some variables #8

Closed dcol2804 closed 3 months ago

dcol2804 commented 3 months ago

I have four variables I would like to extract from files in my directory, downloaded using the ag5_download function but I can only extract two of them: Mean 24 hour temperature and Precipitation Flux. The function can't seem to locate the files for vapour pressure or wind speed. Can you help?

Filenames:

Temperature-Air-2m-Mean-24h_C3S-glob-agric_AgERA5_20110101_final-v1.1.nc

Precipitation-Flux_C3S-glob-agric_AgERA5_20110101_final-v1.1.nc

Vapour-Pressure-Mean_C3S-glob-agric_AgERA5_20110101_final-v1.1.nc

Wind-Speed-10m-Mean_C3S-glob-agric_AgERA5_20110101_final-v1.1.nc

When I run the following code, temperature and precipitation are found but vapour pressure and wind speed are not.

ag5_extract(coords = c(-54.45582, -25.64690), dates = "2011-01-01", variable = "Temperature-Air-2m", statistic = "Mean-24h", celsius = T, path = "my_directory/")

2011-01-01 1 23.09246

ag5_extract(coords = c(-54.45582, -25.64690), dates = "2011-01-01", variable = "Precipitation-Flux", path = "my_directory/")

2011-01-01 1 11.4

ag5_extract(coords = c(-54.45582, -25.64690), dates = "2011-01-01", variable = "vapour_pressure", statistic = "24_hour_mean", path = "my_directory/")

Error in get_file_path(date_to_search = dates, variable, statistic, time, : File not found

ag5_extract(coords = c(-54.45582, -25.64690), dates = "2011-01-01", variable = "10m_wind_speed", statistic = "24_hour_mean", path = "my_directory/")

Error in get_file_path(date_to_search = dates, variable, statistic, time, : File not found

dbrownf commented 3 months ago

Could you please try with the development version?

Thanks.

dcol2804 commented 3 months ago

I tried again with the development version and got the following results:

ag5_extract(coords = c(-54.45582, -25.64690), dates = "2011-01-01", variable = "vapour_pressure", statistic = "24_hour_mean", path = "weather/")

Error in ag5_extract.numeric(coords = c(-54.45582, -25.6469), dates = "2011-01-01", : not valid variable, please check

I guessed that you were now standardising the variable values and tried "Vapour-Pressure". But it still couldn't find the file.

ag5_extract(coords = c(-54.45582, -25.64690), dates = "2011-01-01", variable = "Vapour-Pressure", statistic = "24_hour_mean", path = "weather/")

Error in get_file_path(date_to_search = dates, variable, statistic, time, : File not found

On Mon, 22 Jul 2024 at 23:38, David Brown @.***> wrote:

Could you please try with the development version?

Thanks.

— Reply to this email directly, view it on GitHub https://github.com/AgrDataSci/ag5Tools/issues/8#issuecomment-2242986385, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMADDKFOTXJQOPQL5NST6PTZNUDNNAVCNFSM6AAAAABLHHJD72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBSHE4DMMZYGU . You are receiving this because you authored the thread.Message ID: @.***>

dbrownf commented 3 months ago

I think the problem is with the statistic parameter.

From the package help:

Variables that require statistic For the following variables, only 24 hour mean statistic is available, but should be explicitly indicated as "Mean".

"Cloud-Cover"

"Snow-Thickness-LWE"

"Dew-Point_Temperature-2m"

"Snow-Thickness"

"Vapour-Pressure"

"Wind-Speed-10m"

Could you please try the following:

ag5_extract(coords = c(-54.45582, -25.64690),
            dates = "2011-01-01",
            variable = "Vapour-Pressure",
            statistic = "Mean",
            path = "weather/")

Thanks.

dcol2804 commented 3 months ago

Fantastic! It now works. Thanks for your help

ag5_extract(coords = c(-54.45582, -25.64690), dates = "2011-01-01", variable = "Wind-Speed-10m", statistic = "Mean", path = "weather/")

2011-01-01 1 1.725427

ag5_extract(coords = c(-54.45582, -25.64690), dates = "2011-01-01", variable = "Vapour-Pressure", statistic = "Mean", path = "weather/")

2011-01-01 1 25.80108

On Tue, 23 Jul 2024 at 10:10, David Brown @.***> wrote:

I think the problem is with the statistic parameter.

From the package help:

Variables that require statistic For the following variables, only 24 hour mean statistic is available, but should be explicitly indicated as "Mean".

"Cloud-Cover"

"Snow-Thickness-LWE"

"Dew-Point_Temperature-2m"

"Snow-Thickness"

"Vapour-Pressure"

"Wind-Speed-10m"

Could you please try the following:

ag5_extract(coords = c(-54.45582, -25.64690), dates = "2011-01-01", variable = "Vapour-Pressure", statistic = "Mean", path = "weather/")

Thanks.

— Reply to this email directly, view it on GitHub https://github.com/AgrDataSci/ag5Tools/issues/8#issuecomment-2244019148, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMADDKFNK2MRQYDF2SWFJKTZNWNQ3AVCNFSM6AAAAABLHHJD72VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBUGAYTSMJUHA . You are receiving this because you authored the thread.Message ID: @.***>