R terra can’t read nc4 file as a SpatRaster
I used terra (version 1.7.71) to read the nc4 files.
However it notice that:
Error: [rast] cannot open this file as a SpatRaster: /Users/aa/Desktop/data/MERRA2_400.inst1_2d_lfo_Nx.20230126.nc4.nc4
In addition: Warning message:
`/Users/aa/Desktop/data/MERRA2_400.inst1_2d_lfo_Nx.20230126.nc4.nc4′ not recognized as a supported file format. (GDAL error 4)
Error at installing terra: libproj.so.25: cannot open shared object file
I get the following error at the end of installing terra on linux:
(I have used this package since years ago and installed it several times, and never had this problem):
How to use terra::tapp in 2 consecutives year
I have a set of raster. I would like to apply a function from 2001-01-01 to 2002-12-31 then 2002-01-01 to 2003-12-31. (Two years each time). Is it possible with tapply function (I have something with a loop but it is quite slow).
Why does reclassification of raster data appear NAs using R::terra
I would like to reclassify urban population raster data using natural breakpoint method. Although the original data does not seem to have NAs, there are two raster images that have NAs after classification, has anyone come across a similar situation?
How does the R package `terra` decide on the template raster properties when projecting?
I am trying to understand how the R package terra
decides on the properties of the new raster it creates when projecting. I know best practice when projecting is to use a template raster in the new crs, e.g. project(my_raster, my_template_raster)
. However, if the user does try to project just using a crs e.g. project(my_raster,"ESRI:54009")
, it is not clear how terra
decides on the dimensions, extent and resolution for the template raster in the new projection. For example, in the reprex below, the projected raster does not cover the extent of the projected version of the polygonized raster which seems strange.
How to Correct WorldPop Population Raster Data from Census Data using R::terra package
I downloaded 100m resolution population raster data from WorldPop, and through transprojection and cropping, I got a city’s population spatial distribution raster data, in addition, I have the administrative boundary shapefile data of the county level of this city, and my purpose is to correct the population raster based on the census (county level) data of the year.
CLHS throws error “not a matrix” in R (possible bug?)
I am trying to create a forest inventory plot network to calibrate a lidar dataset to predict forest biometrics. To ensure the plot network represents the full distribution of tree heights present in the lidar coverage, I am using a conditioned Latin Hypercube Sampling approach using the clhs()
function in the “clhs” package. I am using a large random sample of pixels from a canopy height model raster I created as the sample space that will be divided into marginal strata for the conditioned Latin Hypercube Sampling. Following the instruction in the package documentation, I am converting my sampled pixels into a point vector using the “sf” package. However, when I run the clhs::clhs()
routine, I get an error:
Change the crs of a raster to match the crs of a simple feature point object
Say I have a MODIS LAI raster and a simple feature (sf
) object (points) with two different crs. I need to transform the crs of the raster to match the crs of the sf
data (vice versa would also be ok, but I’d prefer to get rid of the MODIS sinusoidal system). Various attempts did not get me to the solution, i.e., having the raster and sf
in the same CRS for further visualization, processing, etcetera. Any help on how can I do this, please? Below are a few options I tried: