isciences / exactextract

Fast and accurate raster zonal statistics
Apache License 2.0
246 stars 32 forks source link

Error: [names<-] incorrect number of names #37

Closed NedaJalali-codes closed 1 year ago

NedaJalali-codes commented 1 year ago

Hi, I want to extract precipitation at national levels. when I use exact_extract I get the following error. I am not sure it is related to the package or the files. I got the nc file from https://www.earthenv.org/streams, and the shape file at national level from GAMD. Here are the codes that I used:

lc_avg <- brick("monthly_prec_sum.nc")
names(lc_avg) <- paste(c("lc_avg"), sprintf("%02d", seq(1:12)), sep="_")
gpkg_admin0 = sf::read_sf('gadm_410-levels.gpkg', layer = 'ADM_0')
temp_col_name = exactextractr::exact_extract(x = lc_avg$lc_avg_01, y = gpkg_admin0, fun = 'sum' )

lc_avg has 12 levels (monthly data).

The error is:

Error: [names<-] incorrect number of names
In addition: Warning message:
In .local(x, y, ...) : Polygons transformed to raster CRS (EPSG:NA)

I appreciate your help.

NedaJalali-codes commented 1 year ago

The issue was not related to exactextract package so I close this issue.