NCEPLIBS-ncio  1.0.0
All Namespaces Files Functions
module_ncio Module Reference

writing requires a template file. More...

Functions/Subroutines

subroutine, public close_dataset (dset, errcode)
 Close a netcdf file, deallocate members of dataset object. More...
 
type(dataset) function, public create_dataset (filename, dsetin, copy_vardata, paropen, nocompress, mpicomm, errcode)
 Create new dataset, using an existing dataset object to define. More...
 
type(dimension) function, public get_dim (dset, dimname)
 Get Dimension object given name. More...
 
integer function, dimension(6), public get_idate_from_time_units (dset)
 return integer array with year,month,day,hour,minute,second parsed from time units attribute. More...
 
integer function, public get_ndim (dset, dimname)
 Get Dimension index given name. More...
 
integer function, public get_nvar (dset, varname)
 Get Variable index given name. More...
 
character(len=nf90_max_name) function, public get_time_units_from_idate (idate, time_measure)
 create time units attribute of form 'hours since YYYY-MM-DD HH:MM:SS' from integer array with year,month,day,hour,minute,second optional argument 'time_measure' can be used to change 'hours' to 'days', 'minutes', 'seconds' etc. More...
 
type(variable) function, public get_var (dset, varname)
 Get Variable object given name. More...
 
logical function, public has_attr (dset, attname, varname)
 
logical function, public has_var (dset, varname)
 
type(dataset) function, public open_dataset (filename, errcode, paropen, mpicomm)
 Open existing dataset, create dataset object for reading netcdf file. More...
 

Detailed Description

writing requires a template file.

Handles 32 and 64 bit real variables, 8, 16 and 32 bit integer variables and char variables. Variables can have up to 5 dimensions.

Author
jeff whitaker jeffr.nosp@m.ey.s.nosp@m..whit.nosp@m.aker.nosp@m.@noaa.nosp@m..gov
Date
201910

Function/Subroutine Documentation

◆ close_dataset()

subroutine, public module_ncio::close_dataset ( type(dataset), intent(inout)  dset,
integer, intent(out), optional  errcode 
)

Close a netcdf file, deallocate members of dataset object.

if optional error return code errcode is not specified, program will stop if a nonzero error code returned by the netcdf lib.

Parameters
filenamefilename for netCDF Dataset.
errcodeoptional error return code. If not specified the program will stop if a nonzero error code returned by the
Author
jeff whitaker

Definition at line 845 of file module_ncio.f90.

◆ create_dataset()

type(dataset) function, public module_ncio::create_dataset ( character(len=*), intent(in)  filename,
type(dataset), intent(in)  dsetin,
logical, intent(in), optional  copy_vardata,
logical, intent(in), optional  paropen,
logical, intent(in), optional  nocompress,
integer, intent(in), optional  mpicomm,
integer, intent(out), optional  errcode 
)

Create new dataset, using an existing dataset object to define.

Variables, dimensions and attributes.

Parameters
filenamefilename for netCDF Dataset.
dsetindataset object to use as a template.
copyvardataoptional flag to control whether all variable data is copied (Default is .false., only coordinate variable data is copied).
errcodeoptional error return code. If not specified the program will stop if a nonzero error code returned by the netcdf lib.
paropenoptional flag to indicate whether to open dataset for parallel access (Default .false.)
nocompressoptional flag to disable compression even if input dataset is compressed (Default .false.).
mpicommoptional MPI communicator to use (Default MPI_COMM_WORLD) ignored if paropen=F
Returns
Dataset object.
Author
jeff whitaker jeffr.nosp@m.ey.s.nosp@m..whit.nosp@m.aker.nosp@m.@noaa.nosp@m..gov

Definition at line 506 of file module_ncio.f90.

◆ get_dim()

type(dimension) function, public module_ncio::get_dim ( type(dataset)  dset,
character(len=*), intent(in)  dimname 
)

Get Dimension object given name.

Parameters
dsetthe dataset
dimnamethe dimension name
Author
jeff whitaker

Definition at line 189 of file module_ncio.f90.

◆ get_idate_from_time_units()

integer function, dimension(6), public module_ncio::get_idate_from_time_units ( type(dataset), intent(in)  dset)

return integer array with year,month,day,hour,minute,second parsed from time units attribute.

Definition at line 1346 of file module_ncio.f90.

◆ get_ndim()

integer function, public module_ncio::get_ndim ( type(dataset), intent(in)  dset,
character(len=*), intent(in)  dimname 
)

Get Dimension index given name.

Dimension object can then be accessed via Datasetdimensions(nvar)

Parameters
dsetthe dataset
dimnamethe dimension name
Returns
Author
jeff whitaker

Definition at line 205 of file module_ncio.f90.

◆ get_nvar()

integer function, public module_ncio::get_nvar ( type(dataset), intent(in)  dset,
character(len=*), intent(in)  varname 
)

Get Variable index given name.

Parameters
dsetthe dataset
varnamethe variable name
Returns
Author
Jeff Whitaker

Definition at line 288 of file module_ncio.f90.

◆ get_time_units_from_idate()

character(len=nf90_max_name) function, public module_ncio::get_time_units_from_idate ( integer, dimension(6), intent(in)  idate,
character(len=*), intent(in), optional  time_measure 
)

create time units attribute of form 'hours since YYYY-MM-DD HH:MM:SS' from integer array with year,month,day,hour,minute,second optional argument 'time_measure' can be used to change 'hours' to 'days', 'minutes', 'seconds' etc.

Definition at line 1373 of file module_ncio.f90.

◆ get_var()

type(variable) function, public module_ncio::get_var ( type(dataset)  dset,
character(len=*)  varname 
)

Get Variable object given name.

Parameters
dsetthe dataset
varnamethe variable name
Returns
Author
Jeff Whitaker

Definition at line 224 of file module_ncio.f90.

◆ has_attr()

logical function, public module_ncio::has_attr ( type(dataset)  dset,
character(len=*)  attname,
character(len=*), optional  varname 
)
Returns
.true. if attribute exists in dset, otherwise .false. use optional kwarg varname to check for a variable attribute.
Parameters
dset
attnamethe attribute name
varnamethe variable name
Returns
Author
Jeff Whitaker

Definition at line 258 of file module_ncio.f90.

◆ has_var()

logical function, public module_ncio::has_var ( type(dataset)  dset,
character(len=*)  varname 
)
Returns
.true. is varname exists in dset, otherwise .false.
Parameters
dsetthe dataset
varnamethe variable name
Returns

Definition at line 238 of file module_ncio.f90.

◆ open_dataset()

type(dataset) function, public module_ncio::open_dataset ( character(len=*), intent(in)  filename,
integer, intent(out), optional  errcode,
logical, intent(in), optional  paropen,
integer, intent(in), optional  mpicomm 
)

Open existing dataset, create dataset object for reading netcdf file.

Parameters
filenamefilename of netCDF Dataset.
errcodeoptional error return code. If not specified the program will stop if a nonzero error code returned by the netcdf lib.
paropenoptional flag to indicate whether to open dataset for parallel access (Default .false.)
mpicommoptional MPI communicator to use (Default MPI_COMM_WORLD) ignored if paropen=F
Returns
Dataset object.
Author
Jeff Whitaker

Definition at line 358 of file module_ncio.f90.