Skip to main content

griddims

Reads the grid dimensions and coordinate arrays from a NetCDF file into an FPL structure.

Signature

call griddims(ifile, idata)
ParameterIntentTypeDescription
ifileincharacter(*)Path to the NetCDF file
idatainoutFPL typeStructure to populate with dimension info

Behavior

  1. Opens the NetCDF file in read-only mode
  2. Queries dimension sizes (nlons, nlats, and optionally ntimes, nlevels)
  3. Allocates and reads coordinate arrays (longitudes, latitudes, times, levels)
  4. Closes the file
note

You must set varname, lonname, latname (and timename, levelname for 3D/4D) before calling griddims.

Supported Types

Works with all 100 FPL data types (2D, 3D, 4D) via the griddims generic interface.

Example

type(nc2d_float_llf) :: temp

temp%varname = "temperature"
temp%lonname = "lon"
temp%latname = "lat"

call griddims("data.nc", temp)

write(*,*) "Grid:", temp%nlons, "x", temp%nlats