ErikKusch / KrigR

An R Package for downloading, preprocessing, and statistical downscaling of the European Centre for Medium-range Weather Forecasts ReAnalysis 5 (ERA5) family provided by the European Centre for Medium‐Range Weather Forecasts (ECMWF).
MIT License
104 stars 24 forks source link

NA values when PrecipFix = TRUE in precipitation download #42

Closed Doltrix closed 1 year ago

Doltrix commented 1 year ago

Hello again I have a doubt how can I download daily precipitation information (disaggregated).

I used: PrecipFix=True TResilution="day" TStep= 1

And I got a NetCDF file with only NA values in all its layers.

Thanks for your help.

ErikKusch commented 1 year ago

I am afraid I cannot reproduce the issue.

I did, however, notice a different bug introduced with layer name assignment in #39 that I have fixed now with #43.

Back to your issue. This code:

Extent_ext <- extent(c(9.87, 15.03, 49.89, 53.06))
Precip_Raw <- download_ERA(
  Variable = "total_precipitation",
  PrecipFix = TRUE,
  DataSet = "era5-land",
  DateStart = "1995-01-02",
  DateStop = "1995-01-03",
  TResolution = "day",
  TStep = 1,
  Extent = Extent_ext,
  FileName = "TestPrecip",
  API_User = API_User,
  API_Key = API_Key
)

works just fine for me and when plotted produces this:

plot(Precip_Raw)

PrecipWorks

Have you tried installing the latest version of KrigR? Please provide further detail if the issue persists and I will reopen the issue.

Doltrix commented 1 year ago

It seems to be working very well now. I don't know what changes you made, but I reinstalled krigR and now it worked. I used a small example as well. This is how I'm using it:

Precip_00_20<-download_ERA( Variable = 'total_precipitation', PrecipFix = TRUE, Type = "reanalysis", DataSet = "era5-land", DateStart = "2000-01-01", DateStop = "2000-01-10", TResolution = "day", TStep = 1, Extent = extent(-78.83, -77.87, -0.73, 0.34), Buffer = 0.5, Dir = ('E:/), FileName = 'Precip_00_20', API_User = API_User, API_Key =API_Key , TryDown = 10, verbose = TRUE, Cores =5, TimeOut = 36000)

I received this: image

This solves it for now. However, in my particular case I still have the problem of not being able to use more than 5 cores without my pc crashing. It is very rare actually when some time ago I could use detectCores() without problem (my pc has 20 cores). Thank you very much for your very timely response to the doubts that we have, it is noted that you are a great professional.

ErikKusch commented 1 year ago

Happy to hear the issue was solved for you with a reinstall of the package!

As far as the cores are concerned, I am afraid I still cannot reproduce this issue. If, when it happens, you are somehow able to extract a crash report or something of the sort, I would be happy to investigate this issue. Alternatively, if you find a specification whereby more than 5 cores lead to reliable errors/crashes, I could start troubleshooting from there.