1

I am using data from UKCP Local Projections at 2.2km Resolution. The data does not have any stored coordinate reference system. However, the associated documentation explains that UKCP use rotated pole coordinate system with following attributes:

  • Rotated Pole
  • Grid North Pole latitude = 37.5
  • Grid North Pole longitude = 177.5

For my data analysis, I need to convert this data to WGS84. I have read multiple threads at different sites but I could'nt figure out how I can fix this issue.

Here is my code:

# load libraries
library(raster)
#> Loading required package: sp
library(rgdal)
#> Please note that rgdal will be retired by the end of 2023,
#> plan transition to sf/stars/terra functions using GDAL and PROJ
#> at your earliest convenience.
#> 
#> rgdal: version: 1.5-28, (SVN revision 1158)
#> Geospatial Data Abstraction Library extensions to R successfully loaded
#> Loaded GDAL runtime: GDAL 3.2.1, released 2020/12/29
#> Path to GDAL shared files: C:/Users/mohsi/OneDrive/Documents/R/win-library/4.1/rgdal/gdal
#> GDAL binary built with GEOS: TRUE 
#> Loaded PROJ runtime: Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721]
#> Path to PROJ shared files: C:/Users/mohsi/OneDrive/Documents/R/win-library/4.1/rgdal/proj
#> PROJ CDN enabled: FALSE
#> Linking to sp version:1.4-6
#> To mute warnings of possible GDAL/OSR exportToProj4() degradation,
#> use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
#> Overwritten PROJ_LIB was C:/Users/mohsi/OneDrive/Documents/R/win-library/4.1/rgdal/proj
library(sp)
library(sf)
#> Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE

# netcdf file info
gI <- GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-cpm_uk_2.2km_15_mon_202012-202111.nc")
#> Warning in getProjectionRef(x, OVERRIDE_PROJ_DATUM_WITH_TOWGS84 =
#> OVERRIDE_PROJ_DATUM_WITH_TOWGS84, : Discarded datum unknown in Proj4 definition:
#> +proj=ob_tran +o_proj=longlat +lon_0=357.5 +o_lon_p=0 +o_lat_p=37.5 +R=6371229
#> +no_defs
#> Warning in GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-
#> cpm_uk_2.2km_15_mon_202012-202111.nc"): GeoTransform values not available
#> Warning in GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-
#> cpm_uk_2.2km_15_mon_202012-202111.nc"): statistics not supported by this driver

#> Warning in GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-
#> cpm_uk_2.2km_15_mon_202012-202111.nc"): statistics not supported by this driver

#> Warning in GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-
#> cpm_uk_2.2km_15_mon_202012-202111.nc"): statistics not supported by this driver

#> Warning in GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-
#> cpm_uk_2.2km_15_mon_202012-202111.nc"): statistics not supported by this driver

#> Warning in GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-
#> cpm_uk_2.2km_15_mon_202012-202111.nc"): statistics not supported by this driver

#> Warning in GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-
#> cpm_uk_2.2km_15_mon_202012-202111.nc"): statistics not supported by this driver

#> Warning in GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-
#> cpm_uk_2.2km_15_mon_202012-202111.nc"): statistics not supported by this driver

#> Warning in GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-
#> cpm_uk_2.2km_15_mon_202012-202111.nc"): statistics not supported by this driver

#> Warning in GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-
#> cpm_uk_2.2km_15_mon_202012-202111.nc"): statistics not supported by this driver

#> Warning in GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-
#> cpm_uk_2.2km_15_mon_202012-202111.nc"): statistics not supported by this driver

#> Warning in GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-
#> cpm_uk_2.2km_15_mon_202012-202111.nc"): statistics not supported by this driver

#> Warning in GDALinfo("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-
#> cpm_uk_2.2km_15_mon_202012-202111.nc"): statistics not supported by this driver
attr(gI, "mdata")[grep("^tas", attr(gI, "mdata"))]
#>  [1] "tas#cell_methods=time: mean"                                                   
#>  [2] "tas#coordinates=ensemble_member_id latitude longitude month_number year yyyymm"
#>  [3] "tas#description=Mean air temperature"                                          
#>  [4] "tas#grid_mapping=rotated_latitude_longitude"                                   
#>  [5] "tas#label_units=°C"                                                           
#>  [6] "tas#long_name=Mean air temperature"                                            
#>  [7] "tas#plot_label=Mean air temperature at 1.5m (°C)"                             
#>  [8] "tas#standard_name=air_temperature"                                             
#>  [9] "tas#units=degC"                                                                
#> [10] "tas#_FillValue=1e+020"
attr(gI, "mdata")[grep("^rotated", attr(gI, "mdata"))]
#> [1] "rotated_latitude_longitude#earth_radius=6371229"                        
#> [2] "rotated_latitude_longitude#grid_mapping_name=rotated_latitude_longitude"
#> [3] "rotated_latitude_longitude#grid_north_pole_latitude=37.5"               
#> [4] "rotated_latitude_longitude#grid_north_pole_longitude=177.5"             
#> [5] "rotated_latitude_longitude#longitude_of_prime_meridian=0"               
#> [6] "rotated_latitude_longitude#north_pole_grid_longitude=0"

# "+proj=ob_tran +o_proj=longlat +o_lon_p=177.5 +o_lat_p=37.5 +lon_0=180 +ellps=sphere +no_defs"


# load data
r <- raster::brick("C:/Users/mohsi/Downloads/weather proj data/tas_rcp85_land-cpm_uk_2.2km_15_mon_202012-202111.nc",
                   stopIfNotEqualSpaced = FALSE)
#> Loading required namespace: ncdf4
#> Warning in .getCRSfromGridMap4(atts): cannot process these parts of the crs:
#> grid_north_pole_latitude=37.5
#> grid_north_pole_longitude=177.5
#> north_pole_grid_longitude=0
#> Warning in .getCRSfromGridMap4(atts): cannot create a valid crs
#> grid_mapping_name; false_easting; false_northing; scale_factor_at_projection_origin; scale_factor_at_central_meridian; standard_parallel; standard_parallel1; standard_parallel2; longitude_of_central_meridian; longitude_of_projection_origin; latitude_of_projection_origin; straight_vertical_longitude_from_pole; longitude_of_prime_meridian; semi_major_axis; semi_minor_axis; inverse_flattening; earth_radius; +proj; +x_0; +y_0; +k_0; +k_0; +lat_1; +lat_1; +lat_2; +lon_0; +lon_0; +lat_0; +lon_0; +pm; +a; +b; +rf; +a

# setting crs
raster::crs(r) <- "+proj=ob_tran +o_proj=longlat +o_lon_p=177.5 +o_lat_p=37.5 +lon_0=180 +to_meter=0.01745329"
plot(r)

# reprojecting to WGS84

ss <- projectRaster(r, crs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
plot(ss)

Created on 2022-01-13 by the reprex package (v2.0.1)

Can anyone tell how I can transform this data to WGS84 system?

2
  • gis.stackexchange.com/questions/272483/… might help. Otherwise the transformed true lat-long coordinates are in the NetCDF and can be got using the netcdf4 package.
    – Spacedman
    Jan 13, 2022 at 8:37
  • @Spacedman I had tried this but could not solve the issue. However, I found a blog that helped me to fix it. I'll share it as an answer. Thanks Jan 16, 2022 at 8:49

1 Answer 1

-1

I was able to solve this following code in this blog post:

https://luciazwatts.wordpress.com/2020/07/27/how-to-using-met-office-ukcp18-2-2km-climate-projections/

If someone else is using UKCP data struggling with reprojecting it to WGS84, check this link out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.