*ugrid* ADCIRC vectors in QGIS with MDAL

use nco cli to make compliant files

NCO (NetCDF Climate Operators) cli tools can be used to modify ADCIRC netcdf vector outputs to work with QGIS for vector-specific visualization. ncks creates a new file with a subset of parameters, and ncatted modifies the appropriate variable attributes.

These long_name attribute changes will probably be rolled in to the default outputs in future releases of ADCIRC so that vector visualization in QGIS will work automatically. (These changes have been merged in to the development branch of ADCIRC now, and will be the default in v56)

fort74_mdal.nc streamlines in qgis

fort.74.nc example #

Using the diagnostic output of u/v-component wind input from a typical fort.74.nc file:

  • remove extra variables from the ADCIRC vector output netcdf for space and create an MDAL compatible ugrid file.
1
ncks -x -v nbvv,nvell,nvel,nbdv,nvdll,neta,max_nvell,ibtype,depth "fort.74.nc" "fort.74_mdal.nc"

Next, modify metadata for vector components to help MDAL:

  • change the long_name attribute to include “u/v-component” at the end,
  • and starting with the same text describing the speed/magnitude of the vector components (“Wind speed at 10m”).
1
2
3
4
5
# Modify u-vector long_name attr
ncatted -a long_name,windx,o,c,"Wind speed at 10m u-component" "fort.74_mdal.nc"

# Modify v-vector long_name attr
ncatted -a long_name,windy,o,c,"Wind speed at 10m v-component" "fort.74_mdal.nc"

fort.64.nc example #

A similar proceedure can be done for ADCIRC’s fort.64.nc depth-average velocity output as well. This time the variables are “u-vel” and “v-vel”.

1
2
3
4
5
6
7
ncks -x -v nbvv,nvell,nvel,nbdv,nvdll,neta,max_nvell,ibtype,depth "fort.64.nc" "fort.64_mdal.nc"

# Modify u-vector long_name attr
ncatted -a long_name,u-vel,o,c,"water column vertically averaged velocity u-component" "fort.64_mdal.nc"

# Modify v-vector long_name attr
ncatted -a long_name,v-vel,o,c,"water column vertically averaged velocity v-component" "fort.64_mdal.nc"

Resulting file headers #

long_name is changed, but all other attributes remain unchanged including standard_name.

fort.74.nc (before) #

	double windx(time, node) ;
		windx:long_name = "e/w wind velocity" ;
		windx:standard_name = "eastward_wind" ;
		windx:positive = "east" ;
		windx:units = "m s-1" ;
		windx:_FillValue = -99999. ;
		windx:coordinates = "time y x" ;
		windx:location = "node" ;
		windx:mesh = "adcirc_mesh" ;
	double windy(time, node) ;
		windy:long_name = "n/s wind velocity" ;
		windy:standard_name = "northward_wind" ;
		windy:positive = "north" ;
		windy:units = "m s-1" ;
		windy:_FillValue = -99999. ;
		windy:coordinates = "time y x" ;
		windy:location = "node" ;
		windy:mesh = "adcirc_mesh" ;

fort.74_mdal.nc (after) #

	double windx(time, node) ;
		windx:standard_name = "eastward_wind" ;
		windx:positive = "east" ;
		windx:units = "m s-1" ;
		windx:_FillValue = -99999. ;
		windx:coordinates = "time y x" ;
		windx:location = "node" ;
		windx:mesh = "adcirc_mesh" ;
		windx:long_name = "Wind speed at 10m u-component" ;
	double windy(time, node) ;
		windy:standard_name = "northward_wind" ;
		windy:positive = "north" ;
		windy:units = "m s-1" ;
		windy:_FillValue = -99999. ;
		windy:coordinates = "time y x" ;
		windy:location = "node" ;
		windy:mesh = "adcirc_mesh" ;
		windy:long_name = "Wind speed at 10m v-component" ;