0

Normally when I work with files the coordinates are in lon and lat, but in this case they are in 'grid_longitude'

import xarray as xr
dataset = xr.open_dataset(r'C:\Users\eg\Desktop\nec\sfcan20120101a20121231_rot_mask.nc')
dataset

<xarray.Dataset>
Dimensions:        (height: 1, rlat: 240, rlon: 280, time: 366)
Coordinates:
* rlon           (rlon) float64 -5.0 -4.95 -4.9 -4.85 ... 8.8 8.85 8.9 8.95
* rlat           (rlat) float64 -6.45 -6.4 -6.35 -6.3 ... 5.35 5.4 5.45 5.5
* height         (height) float64 0.0
* time           (time) datetime64[ns] 2012-01-01T06:00:00 ... 2012-12- 31T06:00:00
Data variables:
rotated_pole   |S1 ...
precipitation  (time, height, rlat, rlon) float32 ...
lon            (rlat, rlon) float32 ...
lat            (rlat, rlon) float32 ...
Attributes:
title:        AEMET High-resolution (0.05 deg) daily gridded precipitatio...
institution:  Agencia Estatal de Meteorologia (AEMET, www.aemet.es)
references:   Peral, C., Navascu�s, B., Ramos, P. Available at: http://ww...
history:      Creation year 2017
Conventions:  CF-1.7
version:      1.0

Someone knows how to turn it to degrees east and degrees north?, thanks

 <xarray.DataArray 'rlon' (rlon: 280)>
 array([-5.  , -4.95, -4.9 , ...,  8.85,  8.9 ,  8.95])
 Coordinates:
  * rlon     (rlon) float64 -5.0 -4.95 -4.9 -4.85 -4.8 ... 8.8 8.85 8.9 8.95
 Attributes:
long_name:      longitude in rotated pole grid
units:          degrees
standard_name:  grid_longitude
axis:           X

<xarray.DataArray 'lon' (rlat: 240, rlon: 280)>
 array([[-11.988, -11.928, -11.868, ...,   4.566,   4.625,   4.684],
   [-11.992, -11.932, -11.872, ...,   4.573,   4.633,   4.692],
   [-11.996, -11.936, -11.876, ...,   4.581,   4.64 ,   4.699],
   ...,
   [-13.136, -13.065, -12.994, ...,   6.57 ,   6.64 ,   6.71 ],
   [-13.142, -13.071, -13.   , ...,   6.58 ,   6.65 ,   6.72 ],
   [-13.148, -13.077, -13.006, ...,   6.59 ,   6.661,   6.731]],
  dtype=float32)
  Coordinates:
  * rlon     (rlon) float64 -5.0 -4.95 -4.9 -4.85 -4.8 ... 8.8 8.85 8.9 8.95
  * rlat     (rlat) float64 -6.45 -6.4 -6.35 -6.3 -6.25 ... 5.35 5.4 5.45 5.5
 Attributes:
long_name:  longitude
units:      degrees_east

That you can see they are completely different

4
  • But aren't they already? Commented Mar 13, 2019 at 10:15
  • No, they are in "grid_longitude" and "grid_latitude" Commented Mar 13, 2019 at 11:17
  • What's the difference between a "grid longitude" and "longitude"? Commented Mar 13, 2019 at 11:56
  • Edit my first post, rlon and long are different, why? I don't know Commented Mar 13, 2019 at 12:53

1 Answer 1

1

The data will derive from a numerical model in which the poles of the model's coordinate system differ from the earth's true poles. This is typically done when running limited area models, in order to keep the poles as far away as possible from the area that is being modelled. This allows the model's resolution to be roughly uniform over the model domain, as the coordinate system is then approximately cartesian and avoids issues where the meridians converge close to the poles.

In order to allow you to geolocate the other fields in the file properly, the CF Conventions mandate that the true location of each point in the model's grid is stored in the file alongside the data arrays, by means of 2-dimensional data variables containing the true longitude and latitude, which in this file have been called lon and lat.

To be completely certain that this is what lon and lat variables contain, you should in principle look at their attributes, and in particular any standard_name or long_name variable attributes, although given their names and the fact that a rotated pole is in use, it is obvious in this case that this is what they contain.

For more information, see http://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/cf-conventions.html#grid-mappings-and-projections (This link is for version 1.7 of the CF conventions, because that is what is in the data file.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.