NetcdfInfo

Prints what a NetCDF file, or any other file or url that netcdf-java opens, contains: its variables, the coordinate systems with their axes and projections, and its grids, with the extent of each one and its time axis. It is the first module to run on a new dataset, to find the names of the grids to give to NetcdfGridDumper and to check their projection, units and fill values.

Details

The file is read with the Unidata netcdf-java library, which opens much more than NetCDF 3 and 4: also HDF4 and HDF-EOS, as the MODIS products, HDF5, GRIB and the OPeNDAP and THREDDS urls. The report has a first part on the whole file and a second one on its grids.

The first part lists the global attributes, the coordinate systems that netcdf-java recognizes, their axes with the attributes and the coordinate transforms, which are the projections of the projected grids, and then every variable, with its type, unit and attributes.

The second part, Grid definitions, lists the variables that are grids, with their full name: the one to give to NetcdfGridDumper, as MODIS_Grid_8Day_1km_LST/Data_Fields/LST_Day_1km for the groups of an HDF file. For each grid it gives the projection, the range and number of values of the x and y axes, the time axis with its first and last dates, and the bounds in longitude and latitude, computed from all the cells.

Projected axes are given in kilometers, as netcdf-java converts them, also when the file has them in meters. The bounds are those of the cell centers, half a cell inside the bounds of the cells.

Parameters

Prints the content of a NetCDF file or url: its variables, coordinate systems and grids, with their extents and times.

Toolbox folder: NetCDF
Status: Certified
Keywords: IO, NetCDF, HDF, MODIS, Metadata
Authors: Antonello Andrea
Class: org.hortonmachine.modules.NetcdfInfo

Inputs

Parameter

Type

Unit

Default

Description

inPath

file

The netcdf file or url to check.

Example

The example prints the content of the sample MODIS tile:

import org.hortonmachine.modules.NetcdfInfo

// the folder with the MODIS tile: change it to yours
var folder = "/data/modis/"

// the variables, coordinate systems and grids of the MODIS land surface temperature tile
var info = new NetcdfInfo()
info.inPath = folder + "MOD11A2.A2024201.h18v04.061.2024211134014.hdf"
info.process()

The file is an HDF-EOS file with 12 grids: the daytime and nighttime temperature, their quality flags, and the times and view angles of the observations. The first one, as printed in the grid definitions at the end of the report:

0) MODIS_Grid_8Day_1km_LST/Data_Fields/LST_Day_1km:
	Attributes:
		long_name: 8-day daytime 1km grid Land-surface Temperature
		units: K
		Number_Type: uint16
		valid_range: 7500 65535
		_FillValue: 0
		LST: LST data * scale_factor
		scale_factor: 0.02
		...
	Projection: Sinusoidal{earthRadius=6371.007181, centMeridian=0.0, falseEasting=0.0, falseNorthing=0.0}
	Proj X Axis (MODIS_Grid_8Day_1km_LST/Data_Fields/XDim): 0.0 -> 1111.0238943338609   (1200)  extent: 1111.0238943338609
	Proj Y Axis (MODIS_Grid_8Day_1km_LST/Data_Fields/YDim): 4448.728704499139 -> 5559.752598833001   (1200)  extent: 1111.0238943338618
	Longitude: 0.0 -> 15.544273903388074  extent: 15.544273903388074
	Latitude: 40.0083333333325 -> 50.00000000000346  extent: 9.991666666670959

The name to use is the full one, with the groups of the HDF file. The temperature is stored as integers to multiply by the scale factor of 0.02 to get kelvin, and 0 marks the cells without data, as the sea and the clouds. The grid is 1200 x 1200 cells on the sinusoidal projection of MODIS, with the axes in kilometers; the tile has no time axis, its date, 19 July 2024, is in the global attribute _MODIS_Date.