On Thu, 5 Apr 2018, Matthias Boer wrote:

Hi all

I am having trouble extracting some climate time series for a series of field 
sites in Antarctica from a netcdf file with a rotated pole projection. The file 
(gridded monthly temperatures for 1979-2016) includes these details about the 
projection:
float rotated_pole[]
           grid_mapping_name: rotated_latitude_longitude
           grid_north_pole_latitude: -180
           grid_north_pole_longitude: -150

proj4_params: -m 57.295779506 +proj=ob_tran +o_proj=latlon +o_lat_p=-180.0 +lon_0=30.0

proj_parameters: -m 57.295779506 +proj=ob_tran +o_proj=latlon +o_lat_p=-180.0 +lon_0=30.0

           projection_name: rotated_latitude_longitude
           long_name: projection details
           EPSG_code:

I can read the netcdf file into R:
tst.s <- stack("filename.nc", varname="var1")

You'll need to look for the arguments supporting +proj=ob_tran (use_ob_tran=) in rgdal::spTransform(). +proj=ob_tran is a complete mess, and until the next release of GDAL, the GDAL netcdf driver will not understand these either. Your best bet may be not to warp the input grids, but to transform the field sites point coordinates to ob_tran to extract the data you need (checking that the transformation seems sensible).

Roger


but this gives a couple of warnings that raster can't understand the projection:
Warning messages:
1: In .stackCDF(x, varname = varname, bands = bands) :
 tskin has 4 dimensions, I am using the last one
2: In .getCRSfromGridMap4(atts) : cannot process these parts of the CRS:
grid_north_pole_latitude=-180; grid_north_pole_longitude=-150; proj4_params=-m 
57.295779506 +proj=ob_tran +o_proj=latlon +o_lat_p=-180.0 +lon_0=30.0; 
proj_parameters=-m 57.295779506 +proj=ob_tran +o_proj=latlon +o_lat_p=-180.0 
+lon_0=30.0; projection_name=rotated_latitude_longitude; long_name=projection 
details; EPSG_code=
3: In .getCRSfromGridMap4(atts) : cannot create a valid CRS
grid_north_pole_latitude=-180; grid_north_pole_longitude=-150; proj4_params=-m 
57.295779506 +proj=ob_tran +o_proj=latlon +o_lat_p=-180.0 +lon_0=30.0; 
proj_parameters=-m 57.295779506 +proj=ob_tran +o_proj=latlon +o_lat_p=-180.0 
+lon_0=30.0; projection_name=rotated_latitude_longitude; long_name=projection 
details; EPSG_code=


Could anyone point me to some code to assign the correct CRS to the imported stack 'tst.s' and then to project it to the 'normal' geographical coordinate system, so I can extract time series for the field site coordinates which are in 'normal' latlong.

Thanks a lot for your time.

Cheers,
Matthias



------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Dr. Matthias M Boer
Hawkesbury Institute for the Environment<http://www.westernsydney.edu.au/hie> | 
Western Sydney University | Hawkesbury Campus, Richmond, NSW 2753, AUSTRALIA
P: +61-(0)2-4570-1373 (direct) | P: +61-(0)2-4570-1941 (admin) | E: 
m.b...@westernsydney.edu.au

Postal address: Locked Bag 1797 | Penrith, NSW 2751, AUSTRALIA
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: roger.biv...@nhh.no
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to