VeruGHub / easyclimate

Easy access to high-resolution daily climate data for Europe
https://verughub.github.io/easyclimate/
GNU General Public License v3.0
45 stars 1 forks source link

We should convert very negative values from the original rasters to NA #27

Closed Pakillo closed 2 years ago

Pakillo commented 2 years ago

Otherwise raster and datasets containing marine pixels become ugly and could lead to potential errors, eg.

library(easyclimate)
library(terra)
#> terra version 1.4.11
cadiz <- vect("POLYGON ((-6 36, -6 36.5, -5 36.5, -5 36))")
ca_temp <- get_daily_climate(coords = cadiz, 
                             climatic_var = "Tmin", 
                             period = "2015-01-05", 
                             output = "raster")
#> 
#> Connecting to the server...
#> 
#> Downloading data... This process might take several minutes
plot(ca_temp)

Created on 2021-10-31 by the reprex package (v2.0.1)

Do you agree to make this change? @VeruGHub

VeruGHub commented 2 years ago

We convert extreme negative values into NA when the output is a data frame but we forget to do it when the output is a raster. As I was looking at the code I have fix it myself:

library(easyclimate)
library(terra)
#> terra version 1.4.17

cadiz <- vect("POLYGON ((-6 36, -6 36.5, -5 36.5, -5 36))")
ca_temp <- get_daily_climate(coords = cadiz, 
                             climatic_var = "Tmin", 
                             period = "2015-01-05", 
                             output = "raster")
#> 
#> Connecting to the server...
#> 
#> Downloading data... This process might take several minutes
plot(ca_temp)

reprex()
#> Error in reprex(): no se pudo encontrar la función "reprex"

Created on 2021-11-11 by the reprex package (v2.0.0)

Pakillo commented 2 years ago

ah, perfect!