Strange spatial reference system netCDF [stars and sf functions not working now]

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Strange spatial reference system netCDF [stars and sf functions not working now]

maurizio marchi
Dear all,
Thanks for your time. Unfortunately the solution the community (i.e.
Edzer Pebesma, https://github.com/r-spatial/stars/issues/175) is not
working anymore. Does anyone knows why the code is now broken? Here the
output of the old R code...

/f<-"tasmax_rcp85_land-rcm_eur_12km_01_mon_198012-208011.nc"//
//library(stars)//
//  Loading required package: abind//
//  Loading required package: sf//
//  Linking to GEOS 3.8.0, GDAL 3.0.2, PROJ 6.2.1//
//r<-read_ncdf(f, ncsub = cbind(start = c(1, 1, 1, 1), count = c(418,
406, 3, 1)), eps=1e-3)//
//  no 'var' specified, using tasmax//
//  other available variables://
//  rotated_latitude_longitude, ensemble_member, time, time_bnds,
grid_latitude, grid_latitude_bnds, grid_longitude, grid_longitude_bnds,
ensemble_member_id, month_number, year, yyyymm//
//  Error in UseMethod("GPFN") : //
//  no applicable method for 'GPFN' applied to an object of class
"rotated_latitude_longitude"//
//rx<-read_stars(f, proxy = TRUE) # only for the crs!//
//  Warning messages://
//  1: In CPL_read_gdal(as.character(x), as.character(options),
as.character(driver),  ://
//    GDAL Message 1: The dataset has several variables that could be
identified as vector fields, but not all share the same primary
dimension. Consequently they will be ignored.//
//  2: In CPL_read_gdal(as.character(x), as.character(options),
as.character(driver),  ://
//    GDAL Message 1: dimension #1 (time) is not a Time dimension.//
//  3: In CPL_read_gdal(as.character(x), as.character(options),
as.character(driver),  ://
//    GDAL Message 1: dimension #0 (ensemble_member) is not a Time
dimension.//
//st_crs(r)<-st_crs(rx)//
//  Warning messages://
//  1: In CPL_crs_from_proj4string(x) ://
//    GDAL Error 1: PROJ: proj_as_wkt: DerivedGeographicCRS can only be
exported to WKT2//
//  2: In CPL_crs_from_proj4string(x) ://
//    GDAL Error 1: PROJ: proj_as_wkt: DerivedGeographicCRS can only be
exported to WKT2//
//r0 = stars:::st_transform_proj.stars(r, 4326)//
//  Error: invalid crs: , reason: generic error of unknown origin//
//  proj_create: unrecognized format / unknown name//
//r0//
//Error: object 'r0' not found//
/
All my bests
--
*Maurizio Marchi,
PhD Forest Science - Ecological Mathematics*
Researcher
CNR - Institute of Biosciences and BioResources (IBBR), Florence
division (Italy)
SkypeID: maurizioxyz
http://ibbr.cnr.it/ibbr/info/people/maurizio-marchi
#####------#####
EUFGIS National Focal Point for Italy (www.eufgis.org)
Scopus Author ID: 57188626512
ResearcherID: T-3813-2019
http://b4est.eu/ project
/...CPUs don't need to sleep.../

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Strange spatial reference system netCDF [stars and sf functions not working now]

Roger Bivand
Administrator
On Tue, 18 Feb 2020, maurizio marchi wrote:

> Dear all,
> Thanks for your time. Unfortunately the solution the community (i.e.
> Edzer Pebesma, https://github.com/r-spatial/stars/issues/175) is not
> working anymore. Does anyone knows why the code is now broken? Here the
> output of the old R code...
>
> /f<-"tasmax_rcp85_land-rcm_eur_12km_01_mon_198012-208011.nc"//
> //library(stars)//
> //  Loading required package: abind//
> //  Loading required package: sf//
> //  Linking to GEOS 3.8.0, GDAL 3.0.2, PROJ 6.2.1//
This seems to be the "smoking gun" - when the code last ran without error,
which versions of GDAL and PROJ were you using? See below for the
PROJ-related error message.

> //r<-read_ncdf(f, ncsub = cbind(start = c(1, 1, 1, 1), count = c(418,
> 406, 3, 1)), eps=1e-3)//
> //  no 'var' specified, using tasmax//
> //  other available variables://
> //  rotated_latitude_longitude, ensemble_member, time, time_bnds,
> grid_latitude, grid_latitude_bnds, grid_longitude, grid_longitude_bnds,
> ensemble_member_id, month_number, year, yyyymm//
> //  Error in UseMethod("GPFN") : //
> //  no applicable method for 'GPFN' applied to an object of class
> "rotated_latitude_longitude"//
> //rx<-read_stars(f, proxy = TRUE) # only for the crs!//
> //  Warning messages://
> //  1: In CPL_read_gdal(as.character(x), as.character(options),
> as.character(driver),  ://
> //    GDAL Message 1: The dataset has several variables that could be
> identified as vector fields, but not all share the same primary
> dimension. Consequently they will be ignored.//
> //  2: In CPL_read_gdal(as.character(x), as.character(options),
> as.character(driver),  ://
> //    GDAL Message 1: dimension #1 (time) is not a Time dimension.//
> //  3: In CPL_read_gdal(as.character(x), as.character(options),
> as.character(driver),  ://
> //    GDAL Message 1: dimension #0 (ensemble_member) is not a Time
> dimension.//
> //st_crs(r)<-st_crs(rx)//
> //  Warning messages://
> //  1: In CPL_crs_from_proj4string(x) ://
> //    GDAL Error 1: PROJ: proj_as_wkt: DerivedGeographicCRS can only be
> exported to WKT2//
> //  2: In CPL_crs_from_proj4string(x) ://
> //    GDAL Error 1: PROJ: proj_as_wkt: DerivedGeographicCRS can only be
> exported to WKT2//
... here ... is the use of code that will vary by GDAL and PROJ versions.

Roger


> //r0 = stars:::st_transform_proj.stars(r, 4326)//
> //  Error: invalid crs: , reason: generic error of unknown origin//
> //  proj_create: unrecognized format / unknown name//
> //r0//
> //Error: object 'r0' not found//
> /
> All my bests
>

--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: Strange spatial reference system netCDF [stars and sf functions not working now]

maurizio marchi
In reply to this post by maurizio marchi
I’m sorry for being the smoking gun but looking at the issue climatological data seems to be difficult to be handled in R...
Yes the issue is connected to the GDAL version. I can’t remember exactly but I’m sure it wasn’t the versions I have now and posted before...
I did a trick using proj4 package and some handmade stuff but not really GIS ;) However my code was not working on other systems so I’m far away from a real solution...
But the main question is Why RCM are delivered in this awful CRS!?
All my bests

--
Maurizio Marchi,
PhD Forest Science - Ecological Mathematics
Researcher
CNR - Institute of Biosciences and BioResources (IBBR), Florence division (Italy)
SkypeID: maurizioxyz
http://www.ibbr.cnr.it/ibbr/info/people/maurizio-marchi
#####------#####
Annals of Silvicultural Research Associated Editor
EUFGIS National Focal Point for Italy (www.eufgis.org)
Scopus Author ID: 57188626512
ResearcherID: T-3813-2019
http://b4est.eu/ project
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo