Closed khufkens closed 5 years ago
The same issue exists for NCSS downloads
# download NCSS data
download_daymet_ncss(location = c(45.1, -70.1 , 45, -70),
start = 1980,
end = 1980,
param ="tmax",
path = "~")
# read in data
s <- raster("~/tmax_daily_1980_ncss.nc")
# plot projection, second parallel is 45 NOT 60
projection(s)
Re-assign the projection of any tile (NCSS or otherwise) to fix the issue locally.
projection(s) <- CRS("+proj=lcc +lon_0=-100 +lat_0=42.5 +x_0=0 +y_0=0 +lat_1=25 +ellps=WGS84 +lat_2=60")
After checking this seems to be a READ error not a write error while downloading from ORNL. This is a mess as this will either be an error in GDAL or NETCDF libraries!!
Using GDAL 2.3 and either converting to geotiff or reading directly using
s <- rgdal::readGDAL("~/tmax_1980_11754.nc")
The coordinates read correctly:
Coordinate Reference System (CRS) arguments: +proj=lcc +lat_1=25 +lat_2=60 +lat_0=42.5 +lon_0=-100 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
However, the raster library messes things up!
raster issue... closed for now
The default projection data in returned tiles seems to be faulty. Mainly the second parallel North is set to 45 where it should be 60. Below is a reproducible example of the issue.
First download an example tile with a recognizable outline for reference
Read in the data with default projection info.
Reproject this data to lat / lon and plot together with a lat / lon representation of the tiles and the coastal outline around NYC. Note the mismatch!
Now overwrite the original project with one where the second parallel North is 60 degrees instead of 45 (as specified on the website), and generate the plot again. Notice that all things align nicely now.