How to use QGIS to convert mesh data to GeoTIFF

From Tygron Preview Support Wiki
Jump to navigation Jump to search

Some software applications, such as D-Hydro, may produce results in a mesh format (.nc). This is a flexible dataformat which includes a temporal component, and can be suitable for data related to themes such as floodings over large areas, but is not directly importable by the Tygron Platform. The data will need to be transformed to a different format, such as GeoTIFF, to import properly.

These steps describe how to use QGIS to access mesh data, as well as perform a batch export of all timeframes as individual GeoTIFFs.

How to convert mesh data to GeoTIFF:
  1. Go to Layer → Add Layer → Add Mesh Layer.
  2. Select the ...MAP.nc file which refers to the desired data, and opt to add it.
  3. If the dataset consists of layers for both 1D data and 2D data, add both layers of data.
  4. Optionally, if only a specific extent should be exported/converted, include a dataset with a matching extent for the desired results.
  5. Ensure the 2D mesh dataset is selected.
  6. Go to View → Panels → Temporal Controller.
  7. Start "Animated Temporal Navigation".
  8. Ensure the navigation is set to the first temporal frame of the data.
  9. Go to Processing → Toolbox.
  10. Find and open the tool "Rasterize Mesh Dataset".
  11. Click on "Run as Batch Process...".
  12. For "Dataset time", opt for "Add values by expression", and use the following formula:
    array_foreach(generate_series(1,TOTAL_AMOUNT_OF_FRAMES),@map_start_time + make_interval(hours:=(hour(@map_interval)*@element)))
    Replace "TOTAL_AMOUNT_OF_FRAMES" with the amount of frames/timesteps the mesh dataset has
  13. For "Dataset groups", in the first row, opt for "Select in Available Dataset Groups", and select the desired group(s) for export.
  14. For "Dataset groups", click on "Fill down".
  15. For "Extent", in the first row, set the appropriate extent, and click on "Fill down".
  16. For "Output coordinate system", in the first row, set the appropriate CRS, and click on "Fill down".
  17. For "Output raster layer", in the first row, use the "..." button to select a location and name for the exported files.
  18. In the prompt which follows, opt for "Autofill mode" set to "Fill with numbers".
  19. Click on "Run" to run the batch.

Notes

  • To ensure data which is compatible for a specific Project, it is possible to export the Neighborhoods from a Project, load that dataset in QGIS and reference that dataset to compute the extent by.
  • Ensure that the original dataset's CRS, the CRS of the dataset to compute an extent with (if applicable), and the output CRS are all the same. Otherwise, issues may arise with the georeference of the output data.