2

I have 32 ncdf4 data that I wish to convert to raster. The script I used works perfectly fine for all data but two. In two of the datasets I get the following error when trying to assess a variable through the ncvar_get command.

Error in Rsx_nc4_get_vara_double: Permission denied
Var: monthly_ET  Ndims: 3   Start: 0,0,0 Count: 2160,4320,12
Error in ncvar_get_inner(ncid2use, varid2use, nc$var[[li]]$missval, addOffset,  : 
  C function R_nc4_get_vara_double returned error

I have already checked permissions on the files, everything is apparently fine. The files have the same format as all other files in the series.

Global_Monthly_ET_2004.nc (NC_FORMAT_CLASSIC):

 3 variables (excluding dimension variables):
    float LAT[lon,lat]   
        long_name: Latitude
        units: degrees
    float LON[lon,lat]   
        long_name: Longitude
        units: degrees
    float monthly_ET[time,lon,lat]   
        long_name: Monthly actural evapotranspirat
        units: mm/m
        time_step: monthly

 3 dimensions:
    lat  Size:2160
    lon  Size:4320
    time  Size:12

2 global attributes:
    Author: Ke Zhang
    Date: May. 17, 2016

Already re-downloaded both files a couple of times. It doesn't seem to be a file problem because I can open and check them using nc_open. It's all there. I've also tried running R as admin.

library(ncdf4)

fname <- ("Global_Monthly_ET_2004.nc")

nc <- nc_open(fname)

array1 <- ncvar_get(nc, "monthly_ET") 

Then I get the aforementioned error

Error in Rsx_nc4_get_vara_double: Permission denied
Var: monthly_ET  Ndims: 3   Start: 0,0,0 Count: 2160,4320,12
Error in ncvar_get_inner(ncid2use, varid2use, nc$var[[li]]$missval, addOffset,  : 
  C function R_nc4_get_vara_double returned error
divibisan
  • 11,659
  • 11
  • 40
  • 58
  • Did you check you have read permissions on the file and/or the directory in which it resides set correctly ? What happens if you type ncdump -h Global_Monthly_ET_2004.nc from the command line? if you get a permission error you need to set it with chmod u+r file (and +rx for the directory) – ClimateUnboxed Apr 03 '19 at 13:44
  • Oh I forgot to mention I'm on Windows 10. Apparently all my permissions are ok. – Pedro Mutti Apr 04 '19 at 07:30

0 Answers0