How to use QGIS to convert mesh data to GeoTIFF
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:
- Go to Layer → Add Layer → Add Mesh Layer.
- Select the ...MAP.nc file which refers to the desired data, and opt to add it.
- If the dataset consists of layers for both 1D data and 2D data, add both layers of data.
- Optionally, if only a specific extent should be exported/converted, include a dataset with a matching extent for the desired results.
- Ensure the 2D mesh dataset is selected.
- Go to View → Panels → Temporal Controller.
- Start "Animated Temporal Navigation".
- Ensure the navigation is set to the first temporal frame of the data.
- Go to Processing → Toolbox.
- Find and open the tool "Rasterize Mesh Dataset".
- Click on "Run as Batch Process...".
- 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 - For "Dataset groups", in the first row, opt for "Select in Available Dataset Groups", and select the desired group(s) for export.
- For "Dataset groups", click on "Fill down".
- For "Extent", in the first row, set the appropriate extent, and click on "Fill down".
- For "Output coordinate system", in the first row, set the appropriate CRS, and click on "Fill down".
- For "Output raster layer", in the first row, use the "..." button to select a location and name for the exported files.
- In the prompt which follows, opt for "Autofill mode" set to "Fill with numbers".
- 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.