Open CeresBarros opened 1 year ago
So I manually unzipped the file (on reproducible.inputPaths
) and then tried to rerun the call.
Right after manually unzipping, I tried to directly load the raster using rast
. That worked:
> rast("F:/Data/CrossProjectRawData/CA_forest_total_biomass_2015.tif")
class : SpatRaster
dimensions : 156966, 193936, 1 (nrow, ncol, nlyr)
resolution : 30, 30 (x, y)
extent : -2660911, 3157169, -851351.9, 3857628 (xmin, xmax, ymin, ymax)
coord. ref. : Lambert_Conformal_Conic_2SP
source : CA_forest_total_biomass_2015.tif
name : CA_forest_total_biomass_2015
I then tried to run the same Cache(prepInputs(...))
call and got the same error, but this time there was no unzipping involved (so maybe the problem is happening on file copying/linking between reproducible.inputPaths
and reproducible.destinationPath
?):
Running preProcess
Preparing: CA_forest_total_biomass_2015.tif
Checking local files...
Finished checking local files.
alsoExtract is unspecified; assuming that all files must be extracted
Extracting all files from archive
Skipping download. All requested files already present
alsoExtract is unspecified; assuming that all files must be extracted
Extracting all files from archive
Skipping extractFromArchive attempt: no files missing
... copying to getOption('reproducible.inputPaths')...
Copy of file: F:/NEcosystemModelling/R/SpaDES/inputs/CA_forest_total_biomass_2015.tif, was created at: F:/Data/CrossProjectRawData/CA_forest_total_biomass_2015.tif
targetFile located at F:/NEcosystemModelling/R/SpaDES/inputs/CA_forest_total_biomass_2015.tif
Loading object into R
Error: [rast] cannot open this file as a SpatRaster: F:/NEcosystemModelling/R/SpaDES/inputs/CA_forest_total_biomass_2015.tif
In addition: Warning messages:
1: In prepInputs(url = "https://opendata.nfis.org/downloads/forest_change/CA_forest_total_biomass_2015_NN.zip", targetFile = "CA_forest_total_biomass_2015.tif", archive = "CA_forest_total_biomass_2015_NN.zip", to = studyArea, datatype = "INT2U", method = "bilinear", filename2 = .suffix("rawBiomassMap.tif", paste0("_", SAname)), overwrite = TRUE): In do.call(theFun, args2): F:/NEcosystemModelling/R/SpaDES/inputs/CA_forest_total_biomass_2015.tif: TIFFFetchDirectory:F:/NEcosystemModelling/R/SpaDES/inputs/CA_forest_total_biomass_2015.tif: Can not read TIFF directory count (GDAL error 1)
2: In prepInputs(url = "https://opendata.nfis.org/downloads/forest_change/CA_forest_total_biomass_2015_NN.zip", targetFile = "CA_forest_total_biomass_2015.tif", archive = "CA_forest_total_biomass_2015_NN.zip", to = studyArea, datatype = "INT2U", method = "bilinear", filename2 = .suffix("rawBiomassMap.tif", paste0("_", SAname)), overwrite = TRUE): In do.call(theFun, args2): F:/NEcosystemModelling/R/SpaDES/inputs/CA_forest_total_biomass_2015.tif: TIFFReadDirectory:Failed to read directory at offset 121770457026 (GDAL error 1)
After the above, I tried to re-load the raster in reproducible.inputPaths
again, using rast
which failed -- the same happends with the copy in reproducible.destinationPath
. This makes me think that somehow the two copies get screwed up by prepInputs/preProcess
?
## reproducible.inputPaths copy
rast("F:/Data/CrossProjectRawData/CA_forest_total_biomass_2015.tif")
Error: [rast] cannot open this file as a SpatRaster: F:/Data/CrossProjectRawData/CA_forest_total_biomass_2015.tif
In addition: Warning messages:
1: F:/Data/CrossProjectRawData/CA_forest_total_biomass_2015.tif: TIFFFetchDirectory:F:/Data/CrossProjectRawData/CA_forest_total_biomass_2015.tif: Can not read TIFF directory count (GDAL error 1)
2: F:/Data/CrossProjectRawData/CA_forest_total_biomass_2015.tif: TIFFReadDirectory:Failed to read directory at offset 121770457026 (GDAL error 1)
## reproducible.destinationPath copy
rast("F:/NEcosystemModelling/R/SpaDES/inputs/CA_forest_total_biomass_2015.tif")
Error: [rast] cannot open this file as a SpatRaster: F:/NEcosystemModelling/R/SpaDES/inputs/CA_forest_total_biomass_2015.tif
In addition: Warning messages:
1: F:/NEcosystemModelling/R/SpaDES/inputs/CA_forest_total_biomass_2015.tif: TIFFFetchDirectory:F:/NEcosystemModelling/R/SpaDES/inputs/CA_forest_total_biomass_2015.tif: Can not read TIFF directory count (GDAL error 1)
2: F:/NEcosystemModelling/R/SpaDES/inputs/CA_forest_total_biomass_2015.tif: TIFFReadDirectory:Failed to read directory at offset 121770457026 (GDAL error 1)
any news on this front @eliotmcintire ?
I've been hitting an issue with loading a very large raster and have recently traced it down to an issue with unzipping.
here's the output of a similar call, in which I was passing the
to = studyArea
andmethod = "bilinear"
arguments (I'm pretty sure the lack of those won't make a difference)When I try a direct
rast
call on the unzipped.tif
I get the same error: