You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having issues with the example code for the shade function in terra when using a larger raster and attempting the stacked example of angles and directions. . It seems the function does run but the produced object has no layers (as expected from the stacked shade angles).
Coming to the conclusion that it is a memory issue that breaks the function internally and no error is reported. Also, when attempting to produce 4 individual shades, and averaging them, it works (with my data).
This is a reproducible example, with a different map from the stackoverflow (so I don't have to paste the link here) but its producing the same results in my computer:
The previous output works fine. But the following just runs h but produces either two things:
no layers or no error message
An object as shown below (when more memory is available maybe? but still not enough) where there is one layer and the other 3 are "question marked"/empty, but the layers "exist".
#get a better shade with different angles and directions
h <- terra::shade(slope, aspect, angle = c(45, 45, 45, 80), direction = c(225, 270, 315, 135))
A secondary issue, was that when looking
But when I looked into the example in the documentation, using my "optional method", the average products seem different (just checking the min and max values of the mean output rasters), which Chris mentioned in the SO question that should not be the case.
Original h object from the documentation example (grouped shading)
h
class : SpatRaster
dimensions : 900, 950, 1 (nrow, ncol, nlyr)
resolution : 0.0008333333, 0.0008333333 (x, y)
extent : 5.741667, 6.533333, 49.44167, 50.19167 (xmin, xmax, ymin, ymax)
coord. ref. : lon/lat WGS 84 (EPSG:4326)
source(s) : memory
varname : elev
name : hs_45_225
min value : 0.5087930
max value : 0.8495533
My version of the object with the documentation example data ("individual shading and mean after")
meanh
class : SpatRaster
dimensions : 900, 950, 1 (nrow, ncol, nlyr)
resolution : 0.0008333333, 0.0008333333 (x, y)
extent : 5.741667, 6.533333, 49.44167, 50.19167 (xmin, xmax, ymin, ymax)
coord. ref. : lon/lat WGS 84 (EPSG:4326)
source(s) : memory
name : mean
min value : 0.6748505
max value : 0.8538219
packageVersion("terra")
[1] ‘1.7.73’
The text was updated successfully, but these errors were encountered:
Can be achieved increasing memory in wopt=list(memmax=.06, or .07. See SO where worked out and likely close. Sorry for my bad advice, but workable now, knowing more.
So modifying the wopt does help but only if filename is given. I attempted to run it without writing the file (without filename) and the code for shade did run and produced an output, but with no layers at all.
I think terra does give out warning or error messages for other process where it runs out of memory (it has happened to me already), so maybe they can add this to the package in a future release? Plus a warning on the documentation that dissag is needed only for low resolution rasters, and using it in larger rasters will produce unexpected results.
I will leave it to the developer team to close the issue if they see fit or whenever they address some of these suggestions!
I am having issues with the example code for the
shade
function interra
when using a larger raster and attempting the stacked example of angles and directions. . It seems the function does run but the produced object has no layers (as expected from the stacked shade angles).We have been trying to figure out the issue in this stackoverflow questions:
https://stackoverflow.com/questions/78116098/terra-shade-function-not-stacking-different-angles-and-directions-with-my-own-da?noredirect=1#comment137741126_78116098
Coming to the conclusion that it is a memory issue that breaks the function internally and no error is reported. Also, when attempting to produce 4 individual shades, and averaging them, it works (with my data).
This is a reproducible example, with a different map from the stackoverflow (so I don't have to paste the link here) but its producing the same results in my computer:
The previous output works fine. But the following just runs
h
but produces either two things:Output with bug:
A raster with some more resolution, may produce zero layer but an SpatRaster with dimensions, resolution, extent, but no min or max values.
I tried just producing the individual shades, and getting a mean via
terra::app()
which seemed to work.A secondary issue, was that when looking
But when I looked into the example in the documentation, using my "optional method", the average products seem different (just checking the min and max values of the mean output rasters), which Chris mentioned in the SO question that should not be the case.
Original h object from the documentation example (grouped shading)
meanh
class : SpatRaster
dimensions : 900, 950, 1 (nrow, ncol, nlyr)
resolution : 0.0008333333, 0.0008333333 (x, y)
extent : 5.741667, 6.533333, 49.44167, 50.19167 (xmin, xmax, ymin, ymax)
coord. ref. : lon/lat WGS 84 (EPSG:4326)
source(s) : memory
name : mean
min value : 0.6748505
max value : 0.8538219
The text was updated successfully, but these errors were encountered: