Closed pjgoodling closed 3 years ago
Hi Phillip,
Thanks for the detailed outline of the issue. This appears to go back to how the PDSI values have been aggrageted on the Northwestern Server. Please see below:
library(ncdf4)
# Point to the Aggregated Dataset
url = 'http://thredds.northwestknowledge.net:8080/thredds/dodsC/agg_terraclimate_PDSI_1958_CurrentYear_GLOBE.nc?PDSI[521:1:525][1240:1:1240][2516:1:2516]'
# Open stream to netcdf file
nc = ncdf4::nc_open(url)
# Extract PDSI values
ncdf4::ncvar_get(nc, "PDSI")
#> [1] 1.2 1.5 1.9 1.4 -1.1
# Point to the yearly file datasets:
url2 = 'http://thredds.northwestknowledge.net:8080/thredds/dodsC/TERRACLIMATE_ALL/data/TerraClimate_PDSI_2001.nc?PDSI[5:1:9][1240:1:1240][2516:1:2516]'
# Open stream to netcdf file
nc2 = ncdf4::nc_open(url2)
# Extract PDSI values
ncdf4::ncvar_get(nc2, "PDSI")
#> [1] 1.2 1.5 1.9 1.4 -1.1
Created on 2019-11-25 by the reprex package (v0.3.0)
In both cases the data truncation/rounding have been done on the data preparation end. ClimateR is just reading the data from these resources. I can try emailing them again on this front.
Sorry I cant be more help!
Mike
Thanks for that quick response, Mike! Its frustrating it's on their end, but reassuring it isn't a problem with ClimateR!
Phillip
@pjgoodling
Its been a while but I am confirming this is still the case:
# Point to the Aggregated Dataset
url = 'http://thredds.northwestknowledge.net:8080/thredds/dodsC/agg_terraclimate_PDSI_1958_CurrentYear_GLOBE.nc?PDSI[521:1:525][1240:1:1240][2516:1:2516]#fillmismatch'
# Open stream to netcdf file
nc = RNetCDF::open.nc(url)
# Extract PDSI values
RNetCDF::var.get.nc(nc, "PDSI", unpack = TRUE)
#> [1] 1.2 1.5 1.9 1.4 -1.1
# Point to the yearly file datasets:
url2 = 'http://thredds.northwestknowledge.net:8080/thredds/dodsC/TERRACLIMATE_ALL/data/TerraClimate_PDSI_2001.nc?PDSI[5:1:9][1240:1:1240][2516:1:2516]#fillmismatch'
# Open stream to netcdf file
nc = RNetCDF::open.nc(url2)
# Extract PDSI values
RNetCDF::var.get.nc(nc, "PDSI", unpack = TRUE)
#> [1] 1.2 1.5 1.9 1.4 -1.1
Hi Mike,
I've noticed that the results from getTerraClim seem to be truncated to 1 decimal place, but do not have the correct rounding when compared with TerraClim data retrieved from the Climate Engine. Here's an example:
The palmer results have 2 significant figures.
When I go to The Climate Engine and retrieve the same dataset using the "Make a Graph" function, I get the following results:
It seems like for August and October 2001, the rounding was incorrectly applied. A few other spot checks shows that the data is truncated rather than rounded. I have only looked through the palmer results, and haven't checked any of the other TerraClim variables.
I was looking through the "fast download" code, but couldn't trace the issue.
Thanks!
Phillip