I'm new to working with geographic data so please bear with me.

I have the following data:

0,-1158000.0,-1036000.0,12,0.0,-2147483647,-1037000.0,-1159000.0,1 days 06:00:00.000000000,2019-03-22 19:00:00,2019-03-24 01:00:00
0,-1158000.0,-1036000.0,13,0.0,-2147483647,-1037000.0,-1159000.0,1 days 06:00:00.000000000,2019-03-22 19:00:00,2019-03-24 01:00:00
0,-1158000.0,-1036000.0,14,0.0,-2147483647,-1037000.0,-1159000.0,1 days 06:00:00.000000000,2019-03-22 19:00:00,2019-03-24 01:00:00
0,-1158000.0,-1034000.0,12,0.0,-2147483647,-1035000.0,-1159000.0,1 days 06:00:00.000000000,2019-03-22 19:00:00,2019-03-24 01:00:00

from which I would like to determine the appropriate lat/long coordinates. Note that the data is in the RotatedGeogCS format and I have x- and y-projections along with a data value for "Lambert Azimuthal Equal Area" projection.

Does anyone know how to convert from the given data to what I want? Is that even the appropriate question to ask here? The end goal is to present the fog_area_fraction data within the region it has been calculated for.

For those curious this data was extracted from the MOGREPS-UK dataset from AWS, processed using libraries for netCDF, xarray and Iris and then dumped to CSV.

EDIT: Here's a sample of the cube in the original form:

    Dimensions:                       (bnds: 2, projection_x_coordinate: 1042, projection_y_coordinate: 970, realization: 3)
  * realization                   (realization) int32 12 13 14
  * projection_y_coordinate       (projection_y_coordinate) float32 -1036000.0 ... 902000.0
  * projection_x_coordinate       (projection_x_coordinate) float32 -1158000.0 ... 924000.0
    forecast_period               timedelta64[ns] ...
    forecast_reference_time       datetime64[ns] ...
    time                          datetime64[ns] ...
Dimensions without coordinates: bnds
Data variables:
    fog_area_fraction             (realization, projection_y_coordinate, projection_x_coordinate) float32 ...
    lambert_azimuthal_equal_area  int32 ...
    projection_y_coordinate_bnds  (projection_y_coordinate, bnds) float32 ...
    projection_x_coordinate_bnds  (projection_x_coordinate, bnds) float32 ...
    history:                      2019-03-22T22:54:56Z: StaGE Decoupler
    institution:                  Met Office
    mosg__forecast_run_duration:  PT126H
    mosg__grid_domain:            uk_extended
    mosg__grid_type:              standard
    mosg__grid_version:           2.1.0
    mosg__model_configuration:    uk_ens
    source:                       Met Office Unified Model
    title:                        MOGREPS-UK Model Forecast on UK 2 km Standa...
    um_version:                   11.1
    Conventions:                  CF-1.5, UKMO-1.0

This should be a comment, but I don't reputation to add it.

According to this help page MOGREPS data comes in a lat/lon grid:

import iris
mydata = iris.load("./prods_op_mogreps-uk_20130101_03_00_003.nc")
11: fog_area_fraction / (1)             (time: 4; grid_latitude: 548; grid_longitude: 421)

Can't you keep those data during prepprocessing?

| improve this answer | |
  • The data that I extracted doesn't have it in that form. – aqua Apr 2 '19 at 21:22

I'm also using the MOGREPS-UK data on AWS.

The following code will plot MOGREPS-UK data for a single ensemble member (AKA 'realization'), with a map of coastlines and latitude & longitude tick labels.

import cartopy.crs as ccrs
import xarray as xr
import matplotlib.pyplot as plt

# Open dataset.
ds = xr.open_dataset(NETCDF_FILENAME)

# Instantiate a Coordinate Reference System (CRS) object for MOGREPS-UK.
central_latitude = ds.lambert_azimuthal_equal_area.latitude_of_projection_origin[0]
central_longitude = ds.lambert_azimuthal_equal_area.longitude_of_projection_origin[0]
mogreps_crs = ccrs.LambertAzimuthalEqualArea(

# Plot with coastlines.
fig = plt.figure()
ax = plt.axes(projection=ccrs.PlateCarree()) # Use lat/lon coordinates.
    ax=ax, add_colorbar=False, transform=mogreps_crs)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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