📔Intro notes

These materials are prepared for the "Working with scientific data formats in GIS" MAGIC Drop-in.

This session is focused on tools and methods to prepare data in scientific/multidimensional formats (HDF, GRIB, NetCDF) for use in GIS, featuring tools like QGIS, GDAL, and XARRAY and GDAL API for Python.

It consists of 3 parts:

  • "Good" HDF is an example of working with QGIS-readable MODIS NDSI data with the GDAL command line tool

  • "Good" GRIB section features the Xarray Python library as an efficient tool for multidimensional data processing

  • "Not-so-good" NetCDF is an example of how to treat datasets with incorrect georeferencing with GDAL and Xarray together

  • Reading Sentinel-3 data is a ready-to-use script for converting Sentinel-3 L1 EFR data to GeoTiff.

Below are the tips for installing the GDAL command line tool and configuring the conda environment for working with GDAL and Xarray in Python. Checked for Python 3.9.

Terminal commands are written in Linux syntax

GDAL installation

Windows

Usually, GDAL is installed along with QGIS. The easiest way to access GDAL is to open OSGeo4W Shell: Start > QGIS > OSGeo4W Shell.

Ubuntu / MacOS

Usually, GDAL is installed along with QGIS and can be called through the terminal window.

No QGIS

Install anaconda. Create a new Python environment.

conda create --name geo
conda activate geo

Install GDAL in this environment

conda install -c conda-forge gdal

Check installation

gdlainfo
Configuring environment for Jupyter Notebook

Install anaconda. Create a new Python environment.

conda create --name geo
conda activate geo

Install geopandas (this will also install numpy, pandas and gdal), matplotlib, xarray and dependables netcdf4 and cfgrib.

conda install -c conda-forge geopandas 
conda install -c conda-forge matplotlib
conda install -c conda-forge cfgrib
conda install -c conda-forge netcdf4
conda install -c conda-forge xarray
conda install -c anaconda jupyter

Navigate to your working directory and start Jupyter

cd /mnt/c/my_dir/
jupyter notebook

A new jupyter session will start and a new browser tab will be open.

Sections 2 through 4 contain *.ipynb files to download.

Data is not provided, but you can download it using links in the 'Data source' section.

Last updated