chrisvwn/Rnightlights

Error in x$.self$finalize() : attempt to apply non-function

Closed this issue · 2 comments

Hello, I tried to run this without gdal and aria2. It seems to run, and took about 5 hours. However, I got a bunch of errors and the resulting dataset has N/A for all the nighttime light values:

pkgOptions(downloadMethod="auto", cropMaskMethod="rast", extractMethod="rast", deleteTiles=TRUE)
ctry <- "IND"
getnldata_VIIRS<-getCtryNlData(ctryCode="IND", admLevel="adm0", custPolyPath="C://Users/Documents/Data/alan/India.zip", nlType="VIIRS.Y", nlPeriods="2015", nlStats="sum", ignoreMissing=FALSE)
Processing missing data: IND:VIIRS.Y:VCM-ORM-NTL:2015:sum. This may take a while.
Note: Set 'ignoreMissing=TRUE' to return only data found or
'ignoreMissing=NULL' to return NULL if not all the data is found
2019-12-12 00:15:30: **** START PROCESSING: ctryCodes=IND, admLevels=0_IAGE71FL_Buffer, nlTypes=VIIRS.Y, configNames=VCM-ORM-NTL, multiTileStrategy=all, multiTileMergeFun=mean, removeGasFlares=TRUE, nlPeriods=2015, nlStats=sum, custPolyPath=C://Users/Documents/Data/alan/India.zip, gadmVersion=3.6, gadmPolyType=shpZip, downloadMethod=auto, cropMaskMethod=rast, extractMethod=rast****
2019-12-12 00:15:30: Downloading country polygons ...
| | 0%2019-12-12 00:15:30: Downloading polygon: IND
2019-12-12 00:15:30: Downloading ctry poly: IND
2019-12-12 00:15:30: Downloading ctry shpZip: IND
2019-12-12 00:15:30: Polygon dir for IND:India.zip already exists
|============================================================================================================| 100%
2019-12-12 00:15:30: Downloading country polygons ... DONE
2019-12-12 00:15:30: **** PROCESSING nlType:VIIRS.Y | configName: VCM-ORM-NTL | nlPeriod:2015****
2019-12-12 00:15:30: Checking tiles required for VIIRS.Y 2015
2019-12-12 00:15:30: IND: Stats missing. Adding tiles
2019-12-12 00:15:30: numTiles: 1, Required tiles: 75N060E
2019-12-12 00:15:30: Downloading tile: 20153
2019-12-12 00:15:30: File exists, set Overwrite = TRUE to overwrite
2019-12-12 00:15:30: Extracting C:/Users/Documents/.Rnightlights/tiles/NL_TILE_VIIRS.Y_VCM-ORM-NTL_2015_75N060E.tgz
2019-12-12 00:15:30: TIF file found
2019-12-12 00:15:30: Processing ctryCode: IND
2019-12-12 00:15:30: Processing ctryCode: IND AdmLevel: 0_IAGE71FL_Buffer
2019-12-12 00:15:30: ProcessNlCountry: ctryCode=IND, admLevel=0_IAGE71FL_Buffer, nlType=VIIRS.Y, configName=VCM-ORM-NTL, multiTileStrategy=all, multiTileMergeFun=mean, removeGasFlares=TRUE, nlPeriod=2015, nlStats=sum, downloadMethod=auto, cropMaskMethod=rast, extractMethod=rast, gadmVersion=3.6, gadmPolyType=shpZip, custPolyPath=C://Users/Documents/Data/alan/India.zip****
2019-12-12 00:15:30: Check for existing data file
2019-12-12 00:15:30: Data file found: C:/Users/Documents/.Rnightlights/data/NL_DATA_IND_IND_0_IAGE71FL_BUFFER_CUST-India.zip.csv
2019-12-12 00:15:30: Processing stats: sum()
2019-12-12 00:15:30: Load country data file
2019-12-12 00:15:31: Load country polygon admin level
2019-12-12 00:15:31: Begin processing 2015
2019-12-12 00:15:31: Country output raster not found. Creating
2019-12-12 00:15:31: Load polygon layer for crop
2019-12-12 00:15:34: Reading in the raster tiles
2019-12-12 00:15:46: Cropping the raster tiles
2019-12-12 00:15:46: Gas flare removal is ON
2019-12-12 00:15:52: Gas flare removal not required for: IND
2019-12-12 00:15:52: Cropping tile = 75N060E
|============================================================================================================| 100%

2019-12-12 00:16:16: Masking the raster
2019-12-12 00:16:16: Mask using rasterize
Error in x$.self$finalize() : attempt to apply non-function
In addition: Warning message:
In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
2019-12-12 04:49:48: Writing the raster to disk
2019-12-12 04:50:07: Crop and mask using rasterize ... Done
2019-12-12 04:50:07: Begin extracting data from the raster
|============================================================================================================| 100%
2019-12-12 05:10:46: Saving nlStat 'sum()' ...
2019-12-12 05:10:47: sum() already saved
2019-12-12 05:10:47: Saving nlStat 'sum' ... DONE
2019-12-12 05:10:47: DONE processing IND 2015
2019-12-12 05:10:47: COMPLETE. Writing data to disk
2019-12-12 05:10:47: Deleting tile TIF: C:/Users/Documents/.Rnightlights/tiles/NL_TILE_VIIRS.Y_VCM-ORM-NTL_2015_75N060E.tif
2019-12-12 05:10:48: Deleting tile ZIP: C:/Users/Documents/.Rnightlights/tiles/NL_TILE_VIIRS.Y_VCM-ORM-NTL_2015_75N060E.tgz
2019-12-12 05:10:48: **** COMPLETED PROCESSING :ctryCodes=IND, admLevels=0_IAGE71FL_Buffer, nlTypes=VIIRS.Y, configNames=VCM-ORM-NTL, multiTileStrategy=all, multiTileMergeFun=mean, removeGasFlares=TRUE, nlPeriods=2015, nlStats=sum, custPolyPath=C://Users/Documents/Data/alan/India.zip, gadmVersion=3.6, gadmPolyType=shpZip, downloadMethod=auto, cropMaskMethod=rast, extractMethod=rast
**
2019-12-12 05:10:48: All stats exist
2019-12-12 05:10:48: Retrieving requested data

Hi @calvinke

Please try to pass na.rm=TRUE as an argument to sum. You can do this by specifying the nlStat as nlStats=list("sum", "na.rm=TRUE"). I believe that error is temporary but I will try to track it down.

You should be able to speed this up a bit more by increasing the pkgOption numThreads. The default is 2 which means 2 (sub)polygons are processed in parallel. Hopefully, we get the gdal option to work for you since I believe it will be significantly faster.

That works now, thanks!