PartMC  2.3.0
Public Member Functions | List of all members
pmc_netcdf Module Reference

Wrapper functions for NetCDF. These all take a NetCDF ncid in data mode and return with it again in data mode. Shifting to define mode is handled internally within each subroutine. More...

Public Member Functions

subroutine pmc_nc_check (status)
 Check the status of a NetCDF function call. More...
 
subroutine pmc_nc_check_msg (status, error_msg)
 Check the status of a NetCDF function call and prints the given error message on failure. More...
 
subroutine pmc_nc_open_read (filename, ncid)
 Open a NetCDF file for reading. More...
 
subroutine pmc_nc_open_write (filename, ncid)
 Open a NetCDF file for writing. More...
 
subroutine pmc_nc_close (ncid)
 Close a NetCDF file. More...
 
subroutine pmc_nc_write_info (ncid, uuid, source, write_rank, write_n_proc)
 Write basic information to a NetCDF file. More...
 
subroutine pmc_nc_read_real (ncid, var, name, must_be_present)
 Read a single real from a NetCDF file. More...
 
subroutine pmc_nc_read_integer (ncid, var, name, must_be_present)
 Read a single integer from a NetCDF file. More...
 
subroutine pmc_nc_read_real_1d (ncid, var, name, must_be_present)
 Read a simple real array from a NetCDF file. More...
 
subroutine pmc_nc_read_integer_1d (ncid, var, name, must_be_present)
 Read a simple integer array from a NetCDF file. More...
 
subroutine pmc_nc_read_real_2d (ncid, var, name, must_be_present)
 Read a simple real 2D array from a NetCDF file. More...
 
subroutine pmc_nc_read_integer_2d (ncid, var, name, must_be_present)
 Read a simple integer 2D array from a NetCDF file. More...
 
subroutine pmc_nc_write_atts (ncid, varid, unit, long_name, standard_name, description)
 Write attributes for a variable to a NetCDF file. More...
 
subroutine pmc_nc_write_real (ncid, var, name, unit, long_name, standard_name, description)
 Write a single real to a NetCDF file. More...
 
subroutine pmc_nc_write_integer (ncid, var, name, unit, long_name, standard_name, description)
 Write a single integer to a NetCDF file. More...
 
subroutine pmc_nc_ensure_dim (ncid, dim_name, dimid, dim_size, array_dim)
 Create a dimension if necessary, or check its size if it already exists. In any case return the dimid. More...
 
subroutine pmc_nc_write_real_1d (ncid, var, name, dimids, dim_name, unit, long_name, standard_name, description)
 Write a simple real array to a NetCDF file. More...
 
subroutine pmc_nc_write_integer_1d (ncid, var, name, dimids, dim_name, unit, long_name, standard_name, description)
 Write a simple integer array to a NetCDF file. More...
 
subroutine pmc_nc_write_real_2d (ncid, var, name, dimids, dim_name_1, dim_name_2, unit, long_name, standard_name, description)
 Write a simple real 2D array to a NetCDF file. More...
 
subroutine pmc_nc_write_integer_2d (ncid, var, name, dimids, dim_name_1, dim_name_2, unit, long_name, standard_name, description)
 Write a simple integer 2D array to a NetCDF file. More...
 

Detailed Description

Wrapper functions for NetCDF. These all take a NetCDF ncid in data mode and return with it again in data mode. Shifting to define mode is handled internally within each subroutine.

Definition at line 11 of file netcdf.F90.

Member Function/Subroutine Documentation

subroutine pmc_netcdf::pmc_nc_check ( integer, intent(in)  status)

Check the status of a NetCDF function call.

Parameters
[in]statusStatus return value.

Definition at line 22 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_check_msg ( integer, intent(in)  status,
character(len=*), intent(in)  error_msg 
)

Check the status of a NetCDF function call and prints the given error message on failure.

Parameters
[in]statusStatus return value.
[in]error_msgError message in case of failure.

Definition at line 37 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_close ( integer, intent(in)  ncid)

Close a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.

Definition at line 85 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_ensure_dim ( integer, intent(in)  ncid,
character(len=*), intent(in)  dim_name,
integer, intent(out)  dimid,
integer, intent(in)  dim_size,
integer, intent(in)  array_dim 
)

Create a dimension if necessary, or check its size if it already exists. In any case return the dimid.

Parameters
[in]ncidNetCDF file ID, in data mode.
[in]dim_nameNetCDF dimension name for the variable.
[out]dimidNetCDF dimension ID.
[in]dim_sizeSize of dimension.
[in]array_dimDimension within data array that this NetCDF dim corresponds to.

Definition at line 461 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_open_read ( character(len=*), intent(in)  filename,
integer, intent(out)  ncid 
)

Open a NetCDF file for reading.

Parameters
[in]filenameFilename of NetCDF file to open.
[out]ncidNetCDF file ID, in data mode.

Definition at line 54 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_open_write ( character(len=*), intent(in)  filename,
integer, intent(out)  ncid 
)

Open a NetCDF file for writing.

Parameters
[in]filenameFilename of NetCDF file to open.
[out]ncidNetCDF file ID, in data mode, returns in data mode.

Definition at line 69 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_read_integer ( integer, intent(in)  ncid,
integer, intent(out)  var,
character(len=*), intent(in)  name,
logical, intent(in), optional  must_be_present 
)

Read a single integer from a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.
[out]varData to write.
[in]nameVariable name in NetCDF file.
[in]must_be_presentWhether the variable must be present in the NetCDF file (default .true.).

Definition at line 183 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_read_integer_1d ( integer, intent(in)  ncid,
integer, dimension(:), intent(out)  var,
character(len=*), intent(in)  name,
logical, intent(in), optional  must_be_present 
)

Read a simple integer array from a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.
[out]varData to read, must be correctly sized.
[in]nameVariable name in NetCDF file.
[in]must_be_presentWhether the variable must be present in the NetCDF file (default .true.).

Definition at line 253 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_read_integer_2d ( integer, intent(in)  ncid,
integer, dimension(:,:), intent(out)  var,
character(len=*), intent(in)  name,
logical, intent(in), optional  must_be_present 
)

Read a simple integer 2D array from a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.
[out]varData to read, must be correctly sized.
[in]nameVariable name in NetCDF file.
[in]must_be_presentWhether the variable must be present in the NetCDF file (default .true.).

Definition at line 323 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_read_real ( integer, intent(in)  ncid,
real(kind=dp), intent(out)  var,
character(len=*), intent(in)  name,
logical, intent(in), optional  must_be_present 
)

Read a single real from a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.
[out]varData to write.
[in]nameVariable name in NetCDF file.
[in]must_be_presentWhether the variable must be present in the NetCDF file (default .true.).

Definition at line 148 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_read_real_1d ( integer, intent(in)  ncid,
real(kind=dp), dimension(:), intent(out)  var,
character(len=*), intent(in)  name,
logical, intent(in), optional  must_be_present 
)

Read a simple real array from a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.
[out]varData to read, must be correctly sized.
[in]nameVariable name in NetCDF file.
[in]must_be_presentWhether the variable must be present in the NetCDF file (default .true.).

Definition at line 218 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_read_real_2d ( integer, intent(in)  ncid,
real(kind=dp), dimension(:,:), intent(out)  var,
character(len=*), intent(in)  name,
logical, intent(in), optional  must_be_present 
)

Read a simple real 2D array from a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.
[out]varData to read, must be correctly sized.
[in]nameVariable name in NetCDF file.
[in]must_be_presentWhether the variable must be present in the NetCDF file (default .true.).

Definition at line 288 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_write_atts ( integer, intent(in)  ncid,
integer, intent(in)  varid,
character(len=*), intent(in), optional  unit,
character(len=*), intent(in), optional  long_name,
character(len=*), intent(in), optional  standard_name,
character(len=*), intent(in), optional  description 
)

Write attributes for a variable to a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in define mode.
[in]varidVariable ID to write attributes for.
[in]unitUnit of variable.
[in]long_nameLong name of variable.
[in]standard_nameStandard name of variable.
[in]descriptionDescription of variable.

Definition at line 358 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_write_info ( integer, intent(in)  ncid,
character(len=pmc_uuid_len), intent(in)  uuid,
character(len=*), intent(in)  source,
integer, intent(in), optional  write_rank,
integer, intent(in), optional  write_n_proc 
)

Write basic information to a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.
[in]uuidUUID for this data set.
[in]sourceSource name for this data.
[in]write_rankRank to write into file.
[in]write_n_procNumber of processes to write into file.

Definition at line 97 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_write_integer ( integer, intent(in)  ncid,
integer, intent(in)  var,
character(len=*), intent(in)  name,
character(len=*), intent(in), optional  unit,
character(len=*), intent(in), optional  long_name,
character(len=*), intent(in), optional  standard_name,
character(len=*), intent(in), optional  description 
)

Write a single integer to a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.
[in]varData to write.
[in]nameVariable name in NetCDF file.
[in]unitUnit of variable.
[in]long_nameLong name of variable.
[in]standard_nameStandard name of variable.
[in]descriptionDescription of variable.

Definition at line 427 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_write_integer_1d ( integer, intent(in)  ncid,
integer, dimension(:), intent(in)  var,
character(len=*), intent(in)  name,
integer, dimension(1), intent(in), optional  dimids,
character(len=*), intent(in), optional  dim_name,
character(len=*), intent(in), optional  unit,
character(len=*), intent(in), optional  long_name,
character(len=*), intent(in), optional  standard_name,
character(len=*), intent(in), optional  description 
)

Write a simple integer array to a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.
[in]varData to write.
[in]nameVariable name in NetCDF file.
[in]dimidsNetCDF dimension IDs of the variable (either this or dim_name must be present).
[in]dim_nameNetCDF dimension name for the variable (either this or dimids must be present).
[in]unitUnit of variable.
[in]long_nameLong name of variable.
[in]standard_nameStandard name of variable.
[in]descriptionDescription of variable.

Definition at line 553 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_write_integer_2d ( integer, intent(in)  ncid,
integer, dimension(:,:), intent(in)  var,
character(len=*), intent(in)  name,
integer, dimension(2), intent(in), optional  dimids,
character(len=*), intent(in), optional  dim_name_1,
character(len=*), intent(in), optional  dim_name_2,
character(len=*), intent(in), optional  unit,
character(len=*), intent(in), optional  long_name,
character(len=*), intent(in), optional  standard_name,
character(len=*), intent(in), optional  description 
)

Write a simple integer 2D array to a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.
[in]varData to write.
[in]nameVariable name in NetCDF file.
[in]dimidsNetCDF dimension IDs of the variable (either dimids or both dim_name_1 and dim_name_2 must be present).
[in]dim_name_1First NetCDF dimension name for the variable (either dimids or both dim_name_1 and dim_name 2 must be present).
[in]dim_name_2Second NetCDF dimension name for the variable (either dimids or both dim_name_1 and dim_name 2 must be present).
[in]unitUnit of variable.
[in]long_nameLong name of variable.
[in]standard_nameStandard name of variable.
[in]descriptionDescription of variable.

Definition at line 656 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_write_real ( integer, intent(in)  ncid,
real(kind=dp), intent(in)  var,
character(len=*), intent(in)  name,
character(len=*), intent(in), optional  unit,
character(len=*), intent(in), optional  long_name,
character(len=*), intent(in), optional  standard_name,
character(len=*), intent(in), optional  description 
)

Write a single real to a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.
[in]varData to write.
[in]nameVariable name in NetCDF file.
[in]unitUnit of variable.
[in]long_nameLong name of variable.
[in]standard_nameStandard name of variable.
[in]descriptionDescription of variable.

Definition at line 394 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_write_real_1d ( integer, intent(in)  ncid,
real(kind=dp), dimension(:), intent(in)  var,
character(len=*), intent(in)  name,
integer, dimension(1), intent(in), optional  dimids,
character(len=*), intent(in), optional  dim_name,
character(len=*), intent(in), optional  unit,
character(len=*), intent(in), optional  long_name,
character(len=*), intent(in), optional  standard_name,
character(len=*), intent(in), optional  description 
)

Write a simple real array to a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.
[in]varData to write.
[in]nameVariable name in NetCDF file.
[in]dimidsNetCDF dimension IDs of the variable (either this or dim_name must be present).
[in]dim_nameNetCDF dimension name for the variable (either this or dimids must be present).
[in]unitUnit of variable.
[in]long_nameLong name of variable.
[in]standard_nameStandard name of variable.
[in]descriptionDescription of variable.

Definition at line 504 of file netcdf.F90.

subroutine pmc_netcdf::pmc_nc_write_real_2d ( integer, intent(in)  ncid,
real(kind=dp), dimension(:,:), intent(in)  var,
character(len=*), intent(in)  name,
integer, dimension(2), intent(in), optional  dimids,
character(len=*), intent(in), optional  dim_name_1,
character(len=*), intent(in), optional  dim_name_2,
character(len=*), intent(in), optional  unit,
character(len=*), intent(in), optional  long_name,
character(len=*), intent(in), optional  standard_name,
character(len=*), intent(in), optional  description 
)

Write a simple real 2D array to a NetCDF file.

Parameters
[in]ncidNetCDF file ID, in data mode.
[in]varData to write.
[in]nameVariable name in NetCDF file.
[in]dimidsNetCDF dimension IDs of the variable (either dimids or both dim_name_1 and dim_name_2 must be present).
[in]dim_name_1First NetCDF dimension name for the variable (either dimids or both dim_name_1 and dim_name 2 must be present).
[in]dim_name_2Second NetCDF dimension name for the variable (either dimids or both dim_name_1 and dim_name 2 must be present).
[in]unitUnit of variable.
[in]long_nameLong name of variable.
[in]standard_nameStandard name of variable.
[in]descriptionDescription of variable.

Definition at line 602 of file netcdf.F90.


The documentation for this module was generated from the following file: