rsbivand / rgrass

Interpreted interface between the GRASS geographical information system and R
https://rsbivand.github.io/rgrass/
26 stars 9 forks source link

nodata error in reading rasters #66

Closed laurapoggio-sptools closed 1 year ago

laurapoggio-sptools commented 2 years ago

I am using rgrass to read a series of raster from GRASS into R Grass version is 8.2, R version is 4.2.1 and the relevant packages loaded are: terra_1.6-7 rgrass_0.3-3

When reading some rasters I get the following error:

r=read_RAST(covs_rst[1])
Error in execGRASS("r.out.gdal", input = vname[i], output = tmplist[[i]],  : 
  The command:
r.out.gdal --overwrite -c -m input=CHILI output=/tmp/grass8-user-1248241/RtmpCH9eBn/file1315197ad806e5.grd format=RRASTER nodata=-1
produced an error (1) during execution:
WARNING: Mismatch between metadata nodata value and actual nodata value in
         exported raster: specified nodata value -1 gets converted to 65535
         by selected GDAL datatype.
WARNING: GDAL datatype: UInt16, valid range: 0 - 65535
ERROR: Raster export aborted.

If I use rgrass7 with use_sp() and raster (raster_3.5-29 sp_1.5-0 rgrass7_0.2-10) it works fine for the same rasters.

I can provide more information and an example of the data if useful

rsbivand commented 2 years ago

Yes, please provide a data example and minimal complete script. Which OS are you using, and how were GRASS and GDAL installed?

laurapoggio-sptools commented 2 years ago

OS is Rocky Linux 8.6, GRASS and GDAL were compiled from source.

GDALVERSION,3.5.1
geos_version,3.10.3
proj_version,9.0.1

This should contain a minimum GRASS location with two rasters: one it works (mask) and one does not (CHILI) test_issue.tar.gz Other not binary rasters work as well, but I can not share them easily. If necessary I will try to get permission

Minimum script

library(rgrass)
library(terra)

rst0=read_RAST("mask")
rst1=read_RAST("CHILI")
rsbivand commented 2 years ago

Thanks, well caught, helpful example! I've pushed a candidate fix to the logic for guessing an appropriate value for the NODATA= argument; please try to install 0.3-4 using remotes::install_github("rsbivand/rgrass") and report back how this works for your full scale case.

laurapoggio-sptools commented 2 years ago

Thanks a lot! It works with most of the rasters, but I got a slightly different error:

Error in execGRASS("r.out.gdal", input = vname[i], output = tmplist[[i]],  : 
  The command:
r.out.gdal --overwrite -c -m input=eu_dem_v11_twi output=/tmp/grass8-user-1251979/RtmpKck2Y0/file131a9377b83a48.grd format=RRASTER nodata=-32769
produced an error (1) during execution:
WARNING: Mismatch between metadata nodata value and actual nodata value in
         exported raster: specified nodata value -32769 gets converted to
         32767 by selected GDAL datatype.
WARNING: GDAL datatype: Int16, valid range: -32768 - 32767
ERROR: Raster export aborted.

test_issue_0109.tar.gz I added the raster from the error message in the mapset as attached

library(rgrass)
library(terra)

rst2=read_RAST("eu_dem_v11_twi") 
rsbivand commented 2 years ago

The underlying problem is that in Int16, it appears that your data creator encoded something as -32768, rather than GRASS NULL (which are not stored in the raster itself) so GRASS thinks of it as a valid value. I'm adding extra logic to read_RAST() to try to fix the problem. Please re-try installing from github again.

laurapoggio-sptools commented 2 years ago

Thanks a lot! It works perfectly now. I will check those data as well. They were ingested in GRASS using the python library and not bash or R as I usually do.

rsbivand commented 2 years ago

It could well be that GRASS NULLs were assigned but the previous values remained. I don't see a flag or parameter to r.out.gdal to hop over assigned NULL values when computing the range.

rsbivand commented 2 years ago
> r.info -h eu_eu_dem_v11_twi
Data Source:

Data Description:
   generated by r.in.gdal
Comments:
   r.in.gdal -o -r input="./lustre_covs/cov_morph/eu_dem_v11_twi.tif.vr\
   t" output="eu_dem_v11_twi" memory=300 offset=0 num_digits=0
> r.info -s eu_eu_dem_v11_twi
min=-32768
max=158
cells=16064064
n=16064064
mean=-2138.17585643334
stddev=8231.49992359011
sum=-34347793801
> r.null map=eu_eu_dem_v11_twi setnull=-32768 
100%
> r.info -s eu_eu_dem_v11_twi
min=19
max=158
cells=16064064
n=14982035
mean=73.964082382667
stddev=11.9724746058333
sum=1108132471

With rgrass 0.3-3:

> rst2=read_RAST("eu_eu_dem_v11_twi") 
WARNING: <PROJ_INFO> file not found for location <example>
WARNING: <PROJ_UNITS> file not found for location <example>
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <Byte>
WARNING: Unable to set projection
Exporting raster data to RRASTER format...
 100%
r.out.gdal complete. File
</tmp/grass8-rsb-234003/Rtmp3uLwFh/file3990363d92d16.grd> created.
Warning message:
In execGRASS("r.out.gdal", input = vname[i], output = tmplist[[i]],  :
  The command:
r.out.gdal --overwrite -c -m input=eu_eu_dem_v11_twi output=/tmp/grass8-rsb-234003/Rtmp3uLwFh/file3990363d92d16.grd format=RRASTER nodata=18
produced at least one warning during execution:
WARNING: <PROJ_INFO> file not found for location <example>
WARNING: <PROJ_UNITS> file not found for location <example>
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <Byte>
WARNING: Unable to set projection
Exporting raster data to RRASTER format...
  [... truncated]
> rst2
class       : SpatRaster 
dimensions  : 5010, 5010, 1  (nrow, ncol, nlyr)
resolution  : 20, 20  (x, y)
extent      : 704740, 804940, 5295020, 5395220  (xmin, xmax, ymin, ymax)
coord. ref. :  
source      : file3990363d92d16.grd 
name        : file3990363d92d16 
min value   :                19 
max value   :               158 
> summary(values(rst2))
 file3990363d92d16
 Min.   : 19      
 1st Qu.: 65      
 Median : 73      
 Mean   : 74      
 3rd Qu.: 81      
 Max.   :158      
 NA's   :1689619  

With 0.3-4:

> rst2=read_RAST("eu_eu_dem_v11_twi") 
WARNING: <PROJ_INFO> file not found for location <example>
WARNING: <PROJ_UNITS> file not found for location <example>
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <Byte>
WARNING: Unable to set projection
Exporting raster data to RRASTER format...
 100%
r.out.gdal complete. File
</tmp/grass8-rsb-234003/RtmpXVUMgn/file399b8610344ee.grd> created.
Warning message:
In execGRASS("r.out.gdal", input = vname[i], output = tmplist[[i]],  :
  The command:
r.out.gdal --overwrite -c -m input=eu_eu_dem_v11_twi output=/tmp/grass8-rsb-234003/RtmpXVUMgn/file399b8610344ee.grd format=RRASTER nodata=255
produced at least one warning during execution:
WARNING: <PROJ_INFO> file not found for location <example>
WARNING: <PROJ_UNITS> file not found for location <example>
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <Byte>
WARNING: Unable to set projection
Exporting raster data to RRASTER format...
   [... truncated]
> rst2
class       : SpatRaster 
dimensions  : 5010, 5010, 1  (nrow, ncol, nlyr)
resolution  : 20, 20  (x, y)
extent      : 704740, 804940, 5295020, 5395220  (xmin, xmax, ymin, ymax)
coord. ref. :  
source      : file399b8610344ee.grd 
name        : file399b8610344ee 
min value   :                19 
max value   :               158 
> summary(values(rst2))
 file399b8610344ee
 Min.   : 19      
 1st Qu.: 65      
 Median : 73      
 Mean   : 74      
 3rd Qu.: 81      
 Max.   :158      
 NA's   :1689619  

So there was an underlying issue in that the GRASS raster NULLs had not been set. I can't see a way to set NODATA in r.in.gdal, nor in the GTiff driver, but https://gdal.org/drivers/raster/vrt.html#vrtrasterband suggests that the *.vrt file could have set it. The r.in.gdal help page does say that r.null should be tried if NODATA isn't picked up by the GDAL driver. Anyway, 0.3-4 resolves the non-use of r.null.

laurapoggio-sptools commented 2 years ago

Thanks for the investigation. Those data are created in a bit convoluted way (but project need do not allow for much simplification): morphological parameters are generated in GRASS in tiles, exported as geotiff, then mosaiced as COGs. The mosaic is clipped and reprojected. Indeed in one step using VRT, the no data was set to a value read from the geotiff. And apparently something went wrong. I will add the r.null step to the workflow to be on the safe side.

Thanks a lot!

veroandreo commented 2 years ago

Sorry for late... I'm facing this same issue. Just for the record, if I use return_format="SGDF" with rgrass 0.3-3, no errors. However, as I'm trying to update from rgrass7 to rgrass some scripts that will go into production in a couple of months, I wonder if the fix will reach CRAN anytime soon?

rsbivand commented 2 years ago

@veroandreo Thanks for reminding me. If you install from github, are the problems resolved? If so, I'll try to submit to CRAN early next week.

veroandreo commented 2 years ago

@veroandreo Thanks for reminding me. If you install from github, are the problems resolved? If so, I'll try to submit to CRAN early next week.

Yes, after installing from github, I removed the return_format="SGDF", and now all goes fine, no error reported :+1:

laurapoggio-sptools commented 2 years ago

I can also confirm that I have been using the github version since the changes and everything worked fine for our project.

rsbivand commented 2 years ago

In 0.3-5 on CRAN now.

veroandreo commented 1 year ago

I'm getting this (or similar) error once more... I have a mapset with CHELSA v2.1 bioclimatic data and I need to read it into R and convert to raster because SDMtune does not take terra objects yet. Basically, this is what I do:

library(rgrass)
library(raster)
library(terra)

myGRASS <- "/home/veroandreo/software/grass-dev/dist.x86_64-pc-linux-gnu"
myGISDbase <- "/home/veroandreo/grassdata"
myLocation <- "sa_latlong_wgs84"
myMapset <- "chelsa_south_america"

# start GRASS GIS from R
initGRASS(gisBase = myGRASS,
          home = tempdir(),
          gisDbase = myGISDbase,
          location = myLocation,
          mapset = myMapset,
          override = TRUE,
          remove_GISRC= TRUE)

# add flebotomos mapset to the search path
execGRASS("g.mapsets", parameters = 
            list(mapset = "flebotomos",
                 operation = "add"))

# set region to species' M
execGRASS("g.region", parameters = 
            list(raster = ecoregions_species,
                 zoom = ecoregions_species),
          flags = "p")

# apply mask
execGRASS("r.mask", parameters = list(raster = ecoregions_species))

# Get list of chelsa data - remove variables with artifacts: bio8, bio9, bio18 & bio19
list_chelsa <- execGRASS("g.list", parameters = 
                           list(type = "raster", 
                                pattern = "V_2_1", 
                                exclude = "bio([0-1][8-9])"),
                         flags = "e")
list_chelsa <- attributes(list_chelsa)$resOut 

# read predictors
predictors <- list()
for (i in list_chelsa){
  predictors[i] <- raster(read_RAST(i)) 
}

chelsa_r <- raster::stack(predictors)

and in the third map that it tries to read into R, I get the following:

Checking GDAL data type and nodata value...
 100%
Using GDAL data type <UInt16>
Exporting raster data to RRASTER format...
 100%
r.out.gdal complete. File </tmp/RtmpEiTock/filef0ef1ec40b77.grd> created.
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <UInt16>
Exporting raster data to RRASTER format...
 100%
r.out.gdal complete. File </tmp/RtmpEiTock/filef0ef2b21ceff.grd> created.
Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'raster': The command:
r.out.gdal --overwrite -c -m input=CHELSA_bio12_1981_2010_V_2_1 output=/tmp/RtmpEiTock/filef0ef76e66872.grd format=RRASTER nodata=4294967295
produced an error (1) during execution:
WARNING: Mismatch between metadata nodata value and actual nodata value in
         exported raster: specified nodata value 4.29497e+09 gets converted
         to 0 by selected GDAL datatype.
WARNING: GDAL datatype: UInt16, valid range: 0 - 65535
ERROR: Raster export aborted.
In addition: Warning messages:
1: In `[<-`(`*tmp*`, i, value = raster(read_RAST(i))) :
  implicit list embedding of S4 objects is deprecated
2: In `[<-`(`*tmp*`, i, value = raster(read_RAST(i))) :
  implicit list embedding of S4 objects is deprecated

The error appears with and without setting a mask, but I do not get why it sets such a high nodata value when exporting. If I export as geotif directly from GRASS, nodata is converted to zero.

This is what I see on the GRASS mapset side:

execGRASS("r.info", parameters = list(map = "CHELSA_bio12_1981_2010_V_2_1"))
 +----------------------------------------------------------------------------+
 | Map:      CHELSA_bio12_1981_2010_V_2_1   Date: Thu Dec  1 17:12:26 2022    |
 | Mapset:   chelsa_south_america           Login of Creator: veroandreo      |
 | Location: sa_latlong_wgs84                                                 |
 | DataBase: /home/veroandreo/grassdata                                       |
 |----------------------------------------------------------------------------|
 |   Type of Map:  raster               Number of Categories: 0               |
 |   Data Type:    CELL                 Semantic label: (none)                |
 |   Rows:         7800                                                       |
 |   Columns:      5040                                                       |
 |   Total Cells:  39312000                                                   |
 |        Projection: Latitude-Longitude                                      |
 |            N:         9N    S:        56S   Res: 0:00:30                   |
 |            E:        34W    W:        76W   Res: 0:00:30                   |
 |   Range of data:    min = 28  max = 65535                                  |
  +----------------------------------------------------------------------------+

execGRASS("r.univar", parameters = list(map = "CHELSA_bio12_1981_2010_V_2_1"))
total null and non-null cells: 19711764
total null cells: 10980143

Of the non-null cells:
----------------------
n: 8731621
minimum: 581
maximum: 34595
range: 34014
mean: 12243
mean of absolute values: 12243
standard deviation: 4517.82
variance: 2.04107e+07
variation coefficient: 36.9014 %
sum: 106900916826

r.info reports on the whole map and r.univar respects the computational region and mask instead. Additionally, a gdalinfo -mm of the original global raster yields the following:

gdalinfo CHELSA_bio12_1981-2010_V.2.1.tif
Driver: GTiff/GeoTIFF
Files: CHELSA_bio12_1981-2010_V.2.1.tif
Size is 43200, 20880
Coordinate System is:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (-180.000138888850017,83.999860415150010)
Pixel Size = (0.008333333300000,-0.008333333300000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=BAND
  PREDICTOR=2
Corner Coordinates:
Upper Left  (-180.0001389,  83.9998604) (180d 0' 0.50"W, 83d59'59.50"N)
Lower Left  (-180.0001389, -90.0001389) (180d 0' 0.50"W, 90d 0' 0.50"S)
Upper Right ( 179.9998597,  83.9998604) (179d59'59.49"E, 83d59'59.50"N)
Lower Right ( 179.9998597, -90.0001389) (179d59'59.49"E, 90d 0' 0.50"S)
Center      (  -0.0001396,  -3.0001392) (  0d 0' 0.50"W,  3d 0' 0.50"S)
Band 1 Block=43200x1 Type=UInt16, ColorInterp=Gray
    Computed Min/Max=0.000,65535.000
  NoData Value=-99999
  Offset: 0,   Scale:0.1

We have 3 different data ranges, which one is rgrass/terra using when reading? I'm really lost here...

I use fedora 36, R 4.1.3., GDAL 3.4.3, GRASS dev (8.3), rgrass 0.3.6, raster 3.6-3 and terra 1.6-17.

rsbivand commented 1 year ago

This is happening in https://github.com/rsbivand/rgrass/blob/a3779d39f60c9ca805431c5d740a965af40e70f2/R/rast_link.R#L66-L111 - specifically line 94. Can you please provide a link to a zip archive of your location, or run debug(read_RAST) and trace where the logic goes wrong?

veroandreo commented 1 year ago

Here's the link to the location: https://mega.nz/file/FFM1EKoI#9dZ4JkET65v9ukrSPQaFrTqI3SvKVwuk_rnkfGvymBs and here's the script again:

# load libraries
library(rgrass)
library(terra)
library(raster)

# path to GRASS binaries (get it with: `grass --config path`)
myGRASS <- "/home/veroandreo/software/grass-dev/dist.x86_64-pc-linux-gnu"
# path to GRASS database
myGISDbase <- "/home/veroandreo/grassdata"
# path to location
myLocation <- "sa_latlong_wgs84_test"
# path to mapset
myMapset <- "chelsa_test"

# start GRASS GIS from R
initGRASS(gisBase = myGRASS,
          home = tempdir(),
          gisDbase = myGISDbase,
          location = myLocation,
          mapset = myMapset,
          override = TRUE,
          remove_GISRC= TRUE)

# Get list of chelsa data
# remove variables with artifacts: bio8, bio9, bio18 & bio19
list_chelsa <- execGRASS("g.list", parameters = 
                           list(type = "raster", 
                                pattern = "V_2_1", 
                                exclude = "bio([0-1][8-9])"),
                         flags = "e")
list_chelsa <- attributes(list_chelsa)$resOut 

# import raster layers
# read predictors
predictors <- list()
for (i in list_chelsa){
  predictors[i] <- raster(read_RAST(i)) 
}

chelsa_r <- raster::stack(predictors)
rm(predictors)

I tried the debug(read_RAST) but I do not really get it... sorry :(

rsbivand commented 1 year ago

For the failing raster:

> lres
$min
[1] 28

$max
[1] 65535

So automatic assignment of NODATA at present does not work. Assigning 0 manually gives:

> summary(values(predictors[[3]]))
 file294021662738 
 Min.   :   28    
 1st Qu.:10456    
 Median :16570    
 Mean   :16872    
 3rd Qu.:22312    
 Max.   :65535    
 NA's   :9907084  

I'll look further.

rsbivand commented 1 year ago

With https://github.com/rsbivand/rgrass/commit/b1dde8d4f5777a7ea8135f0f482318a9ab804436, I see:

> library(rgrass)
Loading required package: XML
GRASS GIS interface loaded with GRASS version: (GRASS not running)
> library(terra)
terra 1.6.47
> library(raster)
Loading required package: sp
> myGRASS <- "/home/rsb/topics/grass/g83dev/grass83"
> myGISDbase <- "/home/rsb/topics/grassdata"
> myLocation <- "sa_latlong_wgs84_test"
> # path to mapset
> myMapset <- "chelsa_test"
> 
> 
> # start GRASS GIS from R
> initGRASS(gisBase = myGRASS,
+           home = tempdir(),
+           gisDbase = myGISDbase,
+           location = myLocation,
+           mapset = myMapset,
+           override = TRUE,
+           remove_GISRC= TRUE)
gisdbase    /home/rsb/topics/grassdata 
location    sa_latlong_wgs84_test 
mapset      chelsa_test 
rows        5971 
columns     4877 
north       8.666667 
south       -41.09167 
west        -75.425 
east        -34.78333 
nsres       0.008333333 
ewres       0.008333333 
projection:
 GEOGCRS["WGS 84",
    ENSEMBLE["World Geodetic System 1984 ensemble",
        MEMBER["World Geodetic System 1984 (Transit)"],
        MEMBER["World Geodetic System 1984 (G730)"],
        MEMBER["World Geodetic System 1984 (G873)"],
        MEMBER["World Geodetic System 1984 (G1150)"],
        MEMBER["World Geodetic System 1984 (G1674)"],
        MEMBER["World Geodetic System 1984 (G1762)"],
        MEMBER["World Geodetic System 1984 (G2139)"],
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]],
        ENSEMBLEACCURACY[2.0]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    USAGE[
        SCOPE["Horizontal component of 3D system."],
        AREA["World."],
        BBOX[-90,-180,90,180]],
    ID["EPSG",4326]] 
> list_chelsa <- execGRASS("g.list", parameters = 
+                            list(type = "raster", 
+                                 pattern = "V_2_1", 
+                                 exclude = "bio([0-1][8-9])"),
+                          flags = "e")
CHELSA_bio10_1981_2010_V_2_1
CHELSA_bio11_1981_2010_V_2_1
CHELSA_bio12_1981_2010_V_2_1
CHELSA_bio13_1981_2010_V_2_1
CHELSA_bio14_1981_2010_V_2_1
CHELSA_bio15_1981_2010_V_2_1
CHELSA_bio16_1981_2010_V_2_1
CHELSA_bio17_1981_2010_V_2_1
> list_chelsa <- attributes(list_chelsa)$resOut 
> 
> # import raster layers
> # read predictors
> predictors <- list()
> for (i in list_chelsa){
+   predictors[i] <- raster(read_RAST(i)) 
+ }
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <UInt16>
Exporting raster data to RRASTER format...
 100%
r.out.gdal complete. File </tmp/RtmprRlc5a/file19f0452e9a17.grd> created.
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <UInt16>
Exporting raster data to RRASTER format...
 100%
r.out.gdal complete. File </tmp/RtmprRlc5a/file19f03dcfc91.grd> created.
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <UInt16>
Exporting raster data to RRASTER format...
 100%
r.out.gdal complete. File </tmp/RtmprRlc5a/file19f027f33d6c.grd> created.
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <UInt16>
Exporting raster data to RRASTER format...
 100%
r.out.gdal complete. File </tmp/RtmprRlc5a/file19f072d70c63.grd> created.
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <UInt16>
Exporting raster data to RRASTER format...
 100%
r.out.gdal complete. File </tmp/RtmprRlc5a/file19f05fa33455.grd> created.
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <UInt16>
Exporting raster data to RRASTER format...
 100%
r.out.gdal complete. File </tmp/RtmprRlc5a/file19f018af6a01.grd> created.
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <UInt16>
Exporting raster data to RRASTER format...
 100%
r.out.gdal complete. File </tmp/RtmprRlc5a/file19f028a72c9.grd> created.
Checking GDAL data type and nodata value...
 100%
Using GDAL data type <UInt16>
Exporting raster data to RRASTER format...
 100%
r.out.gdal complete. File </tmp/RtmprRlc5a/file19f023fc7037.grd> created.
Warning messages:
1: In `[<-`(`*tmp*`, i, value = raster(read_RAST(i))) :
  implicit list embedding of S4 objects is deprecated
2: In `[<-`(`*tmp*`, i, value = raster(read_RAST(i))) :
  implicit list embedding of S4 objects is deprecated
3: In `[<-`(`*tmp*`, i, value = raster(read_RAST(i))) :
  implicit list embedding of S4 objects is deprecated
4: In `[<-`(`*tmp*`, i, value = raster(read_RAST(i))) :
  implicit list embedding of S4 objects is deprecated
5: In `[<-`(`*tmp*`, i, value = raster(read_RAST(i))) :
  implicit list embedding of S4 objects is deprecated
6: In `[<-`(`*tmp*`, i, value = raster(read_RAST(i))) :
  implicit list embedding of S4 objects is deprecated
7: In `[<-`(`*tmp*`, i, value = raster(read_RAST(i))) :
  implicit list embedding of S4 objects is deprecated
8: In `[<-`(`*tmp*`, i, value = raster(read_RAST(i))) :
  implicit list embedding of S4 objects is deprecated
> chelsa_r <- raster::stack(predictors)
> rm(predictors)
> chelsa_r
class      : RasterStack 
dimensions : 5971, 4877, 29120567, 8  (nrow, ncol, ncell, nlayers)
resolution : 0.008333333, 0.008333333  (x, y)
extent     : -75.425, -34.78333, -41.09167, 8.666667  (xmin, xmax, ymin, ymax)
crs        : +proj=longlat +datum=WGS84 +no_defs 
names      : CHELSA_bi//2010_V_2_1, CHELSA_bi//2010_V_2_1, CHELSA_bi//2010_V_2_1, CHELSA_bi//2010_V_2_1, CHELSA_bi//2010_V_2_1, CHELSA_bi//2010_V_2_1, CHELSA_bi//2010_V_2_1, CHELSA_bi//2010_V_2_1 
min values :                  2604,                  2436,                    28,                     5,                     0,                    80,                    14,                     0 
max values :                  3051,                  3014,                 65535,                 16603,                  3788,                  1502,                 45496,                 12441 
veroandreo commented 1 year ago

it looks good!

rsbivand commented 1 year ago

OK, shall I release, or are there other things to do now? I'm a bit concerned about GDAL introducing a signed byte variant, I can't remember whether the RRASTER driver knows how to handle that https://gdal.org/development/rfc/rfc87_signed_int8.html . See thread starting at https://lists.osgeo.org/pipermail/gdal-dev/2022-November/056427.html.

veroandreo commented 1 year ago

OK, shall I release, or are there other things to do now?

I have not found other things, I'm in favor of releasing in that sense.

I'm a bit concerned about GDAL introducing a signed byte variant, I can't remember whether the RRASTER driver knows how to handle that https://gdal.org/development/rfc/rfc87_signed_int8.html . See thread starting at https://lists.osgeo.org/pipermail/gdal-dev/2022-November/056427.html.

One of the files modified in the PR is indeed rrasterdataset.cpp: https://github.com/OSGeo/gdal/pull/6633/files#diff-f536fc95ba3f1f71d1daaf65c9c3ef78696950b8ea3b0a806514880bc0ce555b

Is that the relevant change?

rsbivand commented 1 year ago

Yes, thanks. This is helpful for terra which uses the driver as default. I'm a bit unsure what raster would do with a file in the new format, as it can read files just using R code. But for our purposes this isn't important. I'll look at submitting before the forthcoming break in CRAN submission handling.

florisvdh commented 1 year ago

Regarding release, I intend to add something wrt https://github.com/rsbivand/rgrass/issues/71#issuecomment-1317021154. I hope to do that this week.

rsbivand commented 1 year ago

Thanks, I'll wait until you let me know that you have done what needs doing.

florisvdh commented 1 year ago

Thanks, I'll wait until you let me know that you have done what needs doing.

I forgot to respond here: some ideas were proposed in PR #73 last week.

veroandreo commented 1 year ago

Hi, I'd really need this latest fix in production asap. Is there any plan to release a new version with this bug fixed any time soon?

rsbivand commented 1 year ago

Thanks, I'll try to get to it.

rsbivand commented 1 year ago

package rgrass_0.3-8.tar.gz is on its way to CRAN