rspatial / terra

R package for spatial data handling https://rspatial.github.io/terra/reference/terra-package.html
GNU General Public License v3.0
543 stars 90 forks source link

Issue with time on Linux #1189

Open dominicroye opened 1 year ago

dominicroye commented 1 year ago

I have noticed that on Posit Cloud when I import multidimensional geotiff the time is not formatted correctly:

> rast("./data/horas_sol_esp.tiff")
class       : SpatRaster 
dimensions  : 322, 486, 485  (nrow, ncol, nlyr)
resolution  : 0.05, 0.05  (x, y)
extent      : -20, 4.3, 27.65, 43.75  (xmin, xmax, ymin, ymax)
coord. ref. : lon/lat WGS 84 (EPSG:4326) 
source      : horas_sol_esp.tiff 
names       : SDU,   SDU,   SDU,   SDU,   SDU,   SDU, ... 
min values  : NaN,  22.6, 107.3,  57.1,  67.3, 168.5, ... 
max values  : NaN, 247.1, 313.2, 307.6, 341.2, 365.4, ... 
time        : 410227200 to 1682899200 

Usually, on Windows, I would get dates formatted as %Y-%m%d.

My session Info:


> sessionInfo()
R version 4.3.0 (2023-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3 
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3;  LAPACK version 3.9.0

locale:
 [1] LC_CTYPE=es_ES.UTF8    LC_NUMERIC=C           LC_TIME=es_ES.UTF8     LC_COLLATE=es_ES.UTF8  LC_MONETARY=es_ES.UTF8 LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C           LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

time zone: UTC
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] tiler_0.0.0.4         callr_3.7.3           stars_0.6-1           abind_1.4-5           starsTileServer_0.1.1 tictoc_1.2            waiter_0.2.5         
 [8] htmltools_0.5.5       htmlwidgets_1.6.2     markdown_1.7          ggiraph_0.8.7         shinyjs_2.1.0         ggthemes_4.2.4        fresh_0.2.0          
[15] bs4Dash_2.2.1         shinycssloaders_1.0.0 collapsibleTree_0.1.7 leafem_0.2.0          leaflet_2.1.2         mapview_2.11.0        raster_3.6-20        
[22] sp_1.6-1              terra_1.7-29          shinyWidgets_0.7.6    leafgl_0.1.1          pals_1.7              classInt_0.4-9        lubridate_1.9.2      
[29] forcats_1.0.0         stringr_1.5.0         dplyr_1.1.2           purrr_1.0.1           readr_2.1.4           tidyr_1.3.0           tibble_3.2.1         
[36] ggplot2_3.4.2         tidyverse_2.0.0       sf_1.0-13             RColorBrewer_1.1-3    shiny_1.7.4          

loaded via a namespace (and not attached):
 [1] DBI_1.1.3               rlang_1.1.1             magrittr_2.0.3          e1071_1.7-13            compiler_4.3.0          png_0.1-8              
 [7] systemfonts_1.0.4       vctrs_0.6.2             maps_3.4.1              crayon_1.5.2            pkgconfig_2.0.3         fastmap_1.1.1          
[13] ellipsis_0.3.2          labeling_0.4.2          fontawesome_0.5.1       lwgeom_0.2-13           utf8_1.2.3              promises_1.2.0.1       
[19] tzdb_0.4.0              ps_1.7.5                xfun_0.39               satellite_1.0.4         cachem_1.0.8            jsonlite_1.8.5         
[25] plumber_1.2.1           later_1.3.1             uuid_1.1-0              parallel_4.3.0          data.tree_1.0.0         swagger_3.33.1         
[31] R6_2.5.1                bslib_0.5.0             stringi_1.7.12          jquerylib_0.1.4         Rcpp_1.0.10             assertthat_0.2.1       
[37] base64enc_0.1-3         leaflet.providers_1.9.0 httpuv_1.6.11           timechange_0.2.0        tidyselect_1.2.0        yaml_2.3.7             
[43] rstudioapi_0.14         dichromat_2.0-0.1       codetools_0.2-19        curl_5.0.1              processx_3.8.1          lattice_0.21-8         
[49] webutils_1.1            withr_2.5.0             askpass_1.1             units_0.8-2             proxy_0.4-27            pillar_1.9.0           
[55] rsconnect_0.8.29        KernSmooth_2.23-20      stats4_4.3.0            generics_0.1.3          hms_1.1.3               commonmark_1.9.0       
[61] munsell_0.5.0           scales_1.2.1            xtable_1.8-4            class_7.3-21            glue_1.6.2              mapproj_1.2.11         
[67] tools_4.3.0             webshot_0.5.4           grid_4.3.0              crosstalk_1.2.0         colorspace_2.1-0        cli_3.6.1              
[73] fansi_1.0.4             gtable_0.3.3            sass_0.4.6              digest_0.6.31           farver_2.1.1            memoise_2.0.1          
[79] lifecycle_1.0.3         mime_0.12               openssl_2.0.6    
rhijmans commented 1 year ago

I would need to see the file (or at least the auxiliary .json file that terra uses to store time with GTiff) to be able to look into that.

dominicroye commented 1 year ago

You can fin the used GeoTifff here https://github.com/dominicroye/sun_app/tree/main/data. Thank you

dominicroye commented 1 year ago

You can fin the used GeoTifff here https://github.com/dominicroye/sun_app/tree/main/data. Thank you

Am Fr., 16. Juni 2023 um 18:05 Uhr schrieb Robert Hijmans < @.***>:

I would need to see the file (or at least the auxiliary .json file that terra uses to store time with GTiff) to be able to look into that.

— Reply to this email directly, view it on GitHub https://github.com/rspatial/terra/issues/1189#issuecomment-1594919694, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKCXFZMSW2F5M3LVYYBG3VLXLR75LANCNFSM6AAAAAAZJL77TA . You are receiving this because you authored the thread.Message ID: @.***>

-- Dr. Dominic Royé | Physical Geography Research Group PublicHealth http://www.usc.es/saudep/ Multi-City Multi-Country (MCC) network http://mccstudy.lshtm.ac.uk/ Climate Research Fundation (FIC), Madrid, Spain @.*** linkedin https://www.linkedin.com/ | rearchgate https://www.researchgate.net/profile/Dominic_Roye | @dr_xeo https://twitter.com/dr_xeo https://dominicroye.github.io/