Open kyle-messier opened 1 year ago
That is a good point. I checked and netCDF has FALSE
under "vsi", so I will investigate further. Whats more confusing is that reading the .nc file with terra::rast()
, raster::brick()
, and ncdf4::nc_open()
all return a similar error, even though the same three functions work fine with a local data file.
After seeing this I am not so sure its an issue with terra
or something else.
If the code block below returns zero-rows data.frame, the GDAL in your local might miss netCDF driver.
d = terra::gdal(drivers=TRUE)
d[d$name=="netCDF", ]
How about installing a development version of terra
from GitHub?
install.packages('terra', repos='https://rspatial.r-universe.dev’)
I am still unsure what the problem was, but after re-running the 'wget ...' command I am able to load the data with terra::rast()
. Maybe we will be able to use terra
after all 🤷🏽♂️
Thank you for all the help, Insang. It is much appreciated
Probably there was a transmission issues when downloading the data using wget
. I am glad to hear that the issue is resolved!
To everyone: For making a fail-safe data acquisition workflow, I suggest using checksum to validate the downloaded file is the same as the original on the external server. For example, in MERRA2 data, adding .xml
to the address of .nc4
file will bring me the metadata prepared by NASA. The number in Files>Checksum>CRC32 is a reference to check whether the transmitted data was corrupted in Linux (or Unix-like) systems using cksum $FILENAME
. It took a few seconds to see the checksum result of a MERRA2 file (size=1.1 GB). Comparing checksums would be included in our workflow in the reanalysis phase. A possible issue is that the checksum would not be provided in the data source.
Following today's meeting, I suggest running
sf::st_drivers()
, which returns adata.frame
of GDAL drivers installed in your machine. In my case (R 4.3.1, Ubuntu 22.04),NetCDF has all
TRUE
s across all logical columns, and I did not see errors when I open a MERRA2 file usingMaybe the issue is related to GDAL for MacOS.