🧐"Not-so-good" NetCDF

Sometimes you can encounter problems with data georeferencing, as metadata could be written not in a QGIS-friendly style.

Data source

ESA Permafrost Climate Change Initiative, Permafrost extent for the Northern Hemisphere, v3.0

QGIS

Adding data to the map as usual: the layer has incorrect georeference.

data view in QGIS

Python + XARRAY + GDAL

Let's try to study the dataset with Xarray

The full notebook download is below. To run it, set up conda environment, savethe notebook to your working directory, and run Jupyter Notebook from this directory.

Read and view data

Dataset has 2 variables, one of which is crs, but x and y coordinates are presented as 1-d arrays
data view: the rotation is correct

To export data as GeoTIFF some info georeferencing is needed. For GDAL it is a projection (crs reference) and geotransform parameters (upper left x and y coordinates and pixel size). Some of this info is stored in the polar_stereographic variable.

crs_wkt is in GDAL-compatible format, we can use it. But GeoTransform is not consistent with dataset upper left pixel coordinates:

Save to GeoTIFF

Output file in QGIS map view

Last updated