Skip to content

MODFLOW NetCDF External Tools

mjreno edited this page Oct 12, 2026 · 1 revision

Introduction

This page gives best-practice guidance for loading MODFLOW 6 NetCDF files into third-party GIS/analysis tools, separately from MODFLOW-NetCDF-Format itself. It is being filled in and refined as validation continues; QGIS and ArcGIS are covered first, with other tools to follow.

Choosing between UTL-NCF CRS input options

UTL-NCF accepts several ways to describe a grid's real-world position: WKT (WKT1), CRS_WKT (WKT2), and LATITUDE/LONGITUDE griddata. Which one to use depends on your downstream tooling -- MODFLOW 6 does not know or infer which tool you intend to use, so choose based on the guidance below for your tool and format.

QGIS

Structured format

Supply CRS_WKT (a valid WKT2 PROJCRS) via UTL-NCF, optionally alongside WKT for broader legacy-tool compatibility -- both together is fine and does not cause QGIS to pick the wrong one. If your grid is rotated (ANGROT != 0), no extra step is needed on the MODFLOW 6 side -- the rotation is automatically encoded into the CRS as long as CRS_WKT is supplied and ANGROT/XORIGIN/YORIGIN are correct.

To load and view the file:

  1. Layer -> Add Layer -> Add Raster Layer, and select the variable (e.g. dis_top). The layer will initially look unrotated -- on load, QGIS's project CRS auto-matches the file's own CRS, so this is expected.
  2. Project -> Properties -> CRS, and set the project CRS to your model's real-world CRS (e.g. the EPSG code matching CRS_WKT). This triggers QGIS to reproject the layer, after which it displays correctly rotated and positioned.

Do not rely on WKT alone (without CRS_WKT) for a rotated grid -- the result is not usable, and this may not be obvious from the CRS name QGIS shows on load.

Non-uniform DELR/DELC (variable grid spacing): do not use CRS_WKT -- regardless of rotation, it silently mislocates the data with no warning at all (GDAL cannot build a valid raster geotransform from non-uniformly-spaced coordinate values). This is not an approximation or a minor inaccuracy; the result bears no relationship to the true grid location. Supply LATITUDE/LONGITUDE instead, and use a different QGIS workflow than the rotated case above: after loading, do not rely on changing the project CRS (this produces a "ballpark transformation" warning and stays wrong for this case) -- instead use Raster -> Projections -> Warp (Reproject), setting the target CRS explicitly. This produces a new, correctly positioned layer. Note this is an approximation (interpolated from the point data), not an exact transform -- for a rotated grid with also non-uniform spacing, this can produce visibly irregular cell shapes even though the overall location is correct; the position is trustworthy, the individual cell geometry is not exact.

UGRID Layered Mesh format

Use Layer -> Add Layer -> Add Mesh Layer (not Add Raster Layer) to load a UGRID layered mesh netCDF file -- this is the correct action for this format in QGIS. Supply WKT or CRS_WKT so QGIS can correctly label the CRS. No other action is needed -- MODFLOW 6 always writes true node coordinates for mesh format, so it displays correctly regardless of rotation.

ArcGIS Pro

Structured format

Unrotated grid (ANGROT == 0): supply CRS_WKT (or WKT), load with Make NetCDF Raster Layer. MODFLOW 6 writes the individual CF-standard numeric grid_mapping parameters (central meridian, false easting, etc.) that ArcGIS's classic netCDF connector requires to position a projected grid correctly -- without them it silently defaults every parameter to zero and mislocates the data. Confirmed correct on real ArcGIS output for transverse_mercator-based CRSes (e.g. UTM) and lambert_conformal_conic (two-standard-parallel variant); albers_conical_equal_area uses the identical parameter set and code path as lambert_conformal_conic, so it is expected to behave the same. A 1SP (scale-factor-based) lambert_conformal_conic CRS is not supported for this parameter set -- CF has no scale_factor attribute for this method -- and MODFLOW 6 writes a warning and omits the numeric parameters rather than an inexact approximation.

Rotated grid (ANGROT != 0): ArcGIS's raster tools cannot display this correctly, regardless of CRS input -- a raster requires uniform cell spacing/orientation, which a rotated grid does not have from ArcGIS's perspective. Instead:

  1. Supply LATITUDE/LONGITUDE (not CRS_WKT) via UTL-NCF.
  2. Load with Make NetCDF Feature Layer (not Make NetCDF Raster Layer) -- this produces a point layer (one point per grid cell, at its true position), not a continuous raster surface.
  3. In the tool's parameters, set Row Dimensions to include both y and x (add both, not just one) -- without this, the tool collapses the whole grid into a single aggregate feature instead of one point per cell.

This has been confirmed correct to full coordinate precision on real MODFLOW 6 output. Note the tradeoff: this gives point data at cell centers, not a filled raster -- a genuinely different representation than the unrotated case's raster output, since ArcGIS has no raster mechanism that can represent a rotated grid at all.

Non-uniform DELR/DELC (variable grid spacing): do not use CRS_WKT. Neither ArcGIS raster tool genuinely supports this: Make NetCDF Raster Layer explicitly rejects it with an error ("One or both dimensions have variable spacing in their coordinate values"); Make Multidimensional Raster Layer silently resamples into a completely different, wrong-shaped grid with no warning at all (do not trust its output for this case). Instead, use the same approach as the rotated case: supply LATITUDE/LONGITUDE and load with Make NetCDF Feature Layer (Row Dimensions set to both y and x). Confirmed exact (not approximate) to full coordinate precision on real output -- unlike QGIS's latlon workaround for this same case, which is only an approximation.

Sources (background on why ArcGIS's raster tools can't handle rotation natively):

UGRID Layered Mesh format

No working import path has been identified for UGRID layered mesh netCDF files in ArcGIS Pro -- its netCDF raster tools do not recognize CF-UGRID mesh-topology conventions.

Other tools

GDAL (gdalinfo, gdalwarp)

GDAL is the underlying library QGIS (and ArcGIS's raster tools) use, and its command-line utilities are a quick way to check a file without a full GIS application. All of the following is confirmed against real gdalinfo/gdalwarp output, not just QGIS/ArcGIS's use of GDAL internally.

Structured format:

  • gdalinfo NETCDF:"file.nc":<variable> (e.g. head, dis_top) reads the CRS directly from wkt/crs_wkt -- including a rotated grid's derived CRS -- without needing the CF-standard numeric grid_mapping parameters that ArcGIS's classic netCDF connector requires; those are specific to that connector, not a general GDAL requirement.
  • For a rotated grid, gdalinfo's automatic geographic (lat/lon) corner-coordinate readout already applies the rotation correctly, giving a quick correctness check with no explicit reprojection needed. The raw "Origin"/"Corner Coordinates" in the file's own native coordinates, however, are shown in local (unrotated) form, same as QGIS on initial load -- to get real-world-positioned output in a projected CRS, explicitly reproject: gdalwarp -t_srs <target CRS> NETCDF:"file.nc":<variable> out.tif.
  • Rotated grid with no CRS_WKT rotation encoding (WKT-only input, or an invalid CRS_WKT): gdalinfo/gdalwarp print Warning 1: dimension #.. (x/y) is not a Longitude/X (Latitude/Y) dimension and treat the file as having no usable extent -- this is GDAL correctly refusing to guess a position, not a bug. Supply a valid CRS_WKT for a rotated grid, per the QGIS/ArcGIS guidance above.
  • Non-uniform DELR/DELC (variable grid spacing) has the same CRS_WKT limitation as QGIS/ArcGIS: GDAL cannot build a raster geotransform from non-uniformly-spaced coordinate values. Use LATITUDE/LONGITUDE instead.

UGRID Layered Mesh format: no working path -- GDAL's netCDF driver has no CF-UGRID mesh-topology awareness. It reports a mesh output file as a set of disconnected subdatasets with a meaningless default raster size and no CRS or extent at all. This mirrors ArcGIS's limitation for this format.

rasterio (Python) wraps GDAL directly and behaves identically to gdalinfo/gdalwarp above for both formats -- it is not a separate code path.

cf-python

cf-python is a Python library that parses files strictly against the CF conventions, independent of GDAL -- useful for verifying CF compliance itself, not for GIS display or reprojection (it reads MODFLOW 6's crs_wkt, including a rotated grid's derived-CRS encoding, as a parameter string, but does not apply it -- it has no positioning/reprojection capability of its own). Confirmed clean (cf.read(...), no errors) on both structured (with a projected CRS and rotation configured) and UGRID Layered Mesh output.

Clone this wiki locally