griddims
Reads the grid dimensions and coordinate arrays from a NetCDF file into an FPL structure.
Signature
call griddims(ifile, idata)
| Parameter | Intent | Type | Description |
|---|---|---|---|
ifile | in | character(*) | Path to the NetCDF file |
idata | inout | FPL type | Structure to populate with dimension info |
Behavior
- Opens the NetCDF file in read-only mode
- Queries dimension sizes (
nlons,nlats, and optionallyntimes,nlevels) - Allocates and reads coordinate arrays (
longitudes,latitudes,times,levels) - 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