Skip to content

VERDI not able to read CAMx files #378

@lizadams

Description

@lizadams

Describe the bug
VERDI cannot visualize the latest CAMx netCDF files: point source files, meteorological input files, and possibly others.

Image

Please see below:

Example files that VERDI can't load:
Meteorological inputs for test problem (CAMx v7.32)
Other inputs (IC/BC, photolysis, point sources) for test problem (CAMx v7.32)
in. https://www.camx.com/download/camx-test-case/

To Reproduce
Steps to reproduce the behavior:

  1. VERDI_2.2/verdi.sh -f $cwd/camx.2d.12km.20160610.nc
  2. See error
java.lang.NullPointerException: Cannot invoke "java.lang.Number.doubleValue()" because the return value of "ucar.nc2.Attribute.getNumericValue(int)" is null
	at ucar.nc2.dataset.conv.M3IOConvention.makeZCoordAxis(M3IOConvention.java:245)
	at ucar.nc2.dataset.conv.M3IOConvention.constructCoordAxes(M3IOConvention.java:196)
	at ucar.nc2.dataset.conv.M3IOConvention.augmentDataset(M3IOConvention.java:101)
	at ucar.nc2.dataset.NetcdfDataset.enhance(NetcdfDataset.java:515)
	at ucar.nc2.dataset.NetcdfDataset.<init>(NetcdfDataset.java:1142)
	at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:485)
	at ucar.nc2.dataset.NetcdfDataset.acquireDataset(NetcdfDataset.java:634)
	at ucar.nc2.dt.grid.GridDataset.open(GridDataset.java:86)
	at ucar.nc2.dt.grid.GridDataset.open(GridDataset.java:72)
	at anl.verdi.loaders.NetcdfDatasetFactory.openNetcdfGridDataset(NetcdfDatasetFactory.java:513)
	at anl.verdi.loaders.NetcdfDatasetFactory.createModels3Datasets(NetcdfDatasetFactory.java:175)
	at anl.verdi.loaders.Models3Loader.createDatasets(Models3Loader.java:112)
	at anl.verdi.data.DataManager.createDatasets(DataManager.java:106)
	at anl.verdi.core.VerdiApplication.loadDataset(VerdiApplication.java:647)
	at anl.verdi.commandline.ScriptHandler$2.run(ScriptHandler.java:222)
	at anl.verdi.commandline.ScriptHandler.handleOptions(ScriptHandler.java:1528)
	at anl.verdi.commandline.ScriptHandler.run(ScriptHandler.java:167)
	at anl.verdi.core.VerdiPlugin.run(VerdiPlugin.java:168)
	at saf.core.runtime.CorePlugin.runApplicationRunnable(CorePlugin.java:93)
	at saf.core.runtime.CorePlugin.run(CorePlugin.java:48)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at saf.core.runtime.Boot.run(Boot.java:178)
	at saf.core.runtime.Boot.main(Boot.java:388)
2026.02.26 11:32:14.295 [main] ERROR anl.verdi.loaders.NetcdfDatasetFactory - Error reading netcdf file Cannot invoke "java.lang.Number.doubleValue()" because the return value of "ucar.nc2.Attribute.getNumericValue(int)" is null

ncdump of the file
ncdump camx.2d.12km.20160610.nc | more

netcdf camx.2d.12km.20160610 {
dimensions:
	TSTEP = UNLIMITED ; // (25 currently)
	DATE-TIME = 2 ;
	LAY = 1 ;
	VAR = 17 ;
	ROW = 149 ;
	COL = 152 ;
variables:
	double X(COL) ;
		X:units = "km" ;
		X:long_name = "X coordinate" ;
		X:var_desc = "X cartesian distance from projection origin" ;
	double Y(ROW) ;
		Y:units = "km" ;
		Y:long_name = "Y coordinate" ;
		Y:var_desc = "Y cartesian distance from projection origin" ;
	double layer(LAY) ;
		layer:units = "Layer index" ;
		layer:long_name = "Model layer" ;
		layer:var_desc = "Model layer" ;
	int TFLAG(TSTEP, VAR, DATE-TIME) ;
		TFLAG:units = "YYYYDDD,HHMMSS" ;
		TFLAG:long_name = "Start time flag" ;
		TFLAG:var_desc = "Timestep start date and time" ;
	int ETFLAG(TSTEP, VAR, DATE-TIME) ;
		ETFLAG:units = "YYYYDDD,HHMMSS" ;
		ETFLAG:long_name = "End time flag" ;
		ETFLAG:var_desc = "Timestep end date and time" ;
	double longitude(ROW, COL) ;
		longitude:units = "Degrees east" ;
		longitude:long_name = "Longitude" ;
		longitude:var_desc = "Longitude degrees east" ;
		longitude:coordinates = "latitude longitude" ;
	double latitude(ROW, COL) ;
		latitude:units = "Degrees north" ;
		latitude:long_name = "Latitude" ;
		latitude:var_desc = "Latitude degrees north" ;
		latitude:coordinates = "latitude longitude" ;
	float sfctemperature(TSTEP, LAY, ROW, COL) ;
		sfctemperature:long_name = "surface temperature" ;
		sfctemperature:units = "K                                                           " ;
		sfctemperature:var_desc = "surface temperature" ;
		sfctemperature:coordinates = "latitude longitude" ;

// global attributes:
                :FTYPE = 1 ;
                :CDATE = 2022120 ;
                :CTIME = 110852 ;
                :WDATE = 2022120 ;
                :WTIME = 110852 ;
                :SDATE = 2016162 ;
                :SDATEC = 20160610 ;
                :STIME = 0 ;
                :TSTEP = 10000 ;
                :NTHIK = 1 ;
                :NCOLS = 150 ;
                :NROWS = 147 ;
                :NCOLS_BUF = 152 ;
                :NROWS_BUF = 149 ;
                :NLAYS = 1 ;
                :NVARS = 17 ;
                :GDTYP = 2 ;
                :P_ALP = 45. ;
                :P_BET = 33. ;
                :P_GAM = -97. ;
                :XCENT = -97. ;
                :YCENT = 40. ;
                :XORIG = 468000. ;
                :YORIG = -972000. ;
                :XORIG_BUF = 456000. ;
                :YORIG_BUF = -984000. ;
                :XCELL = 12000. ;
                :YCELL = 12000. ;
                :VGTYP = 6 ;
                :VGTOP = 10000.f ;
                :VGLVLS = 0 ;
                :GDNAM = "" ;
                :UPNAM = "" ;
                :VAR-LIST = "sfctemperature  snowewd         snowage         u10             v10             t2              swsfc           soilmoist       soiltemp        soiltype        pblwrf          pblysu          preciprate      tcloudod        cloudtop        cape            cloudfrac         " ;
                :FILEDESC = "2D METEOROLOGY" ;
                :HISTORY = "Generated by WRFCAMx v5.2 01-10-22" ;
                :IUTM = 0 ;
                :ISTAG = 1 ;
                :CPROJ = 2 ;
                :NSTEPS = 25 ;
                :CAMx_NAME = "2D METEOROLOGY" ;
                :NOTE = "Sample WRFCAMx job" ;
                :ITZON = 0 ;
                :UPDSC = "" ;

Expected behavior
VERDI should load the file properly.

Tested with VERDI 2.2 and VERDI 1.5.

The file that VERDI failed to read is available in this tar.gz file:
camx_test.tar.gz

Additional information
CAMx FAQ: https://www.camx.com/about/faq/

CAMx Latest releases: https://www.camx.com/about/latest-release/

It may be that VERDI stopped reading the CAMx files correctly as of CAMx version 7.0
We have an example CAMx file that uses binary format in the repository that VERDI can read.
./verdi.sh -f $cwd/data/CAMx/camx.example.grd01

https://www.camx.com/Files/Release_notes.v7.00.txt

CAMx now supports netCDF file formats for large gridded input fields
including emissions, meteorology, and initial/boundary conditions. The model
will accept a mix of netCDF or Fortran binary input files for maximum
flexibility and backward compatibility.

Implications: CAMx can be built with netCDF-3 or netCDF-4/HDF5; the latter
allows for data compression using "data chunking".
Uncompressed netCDF files are compatible with Models-3 software
without the need to build CAMx with I/O API libraries.

It may be failing because layer is defined as a double rather than integer.

double layer(LAY) ;
layer:units = "Layer index" ;
layer:long_name = "Model layer" ;
layer:var_desc = "Model layer" ;

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions