netcdf_attributes.f90
!
! Attribute routines:
!
! -------
function nf90_copy_att(ncid_in, varid_in, name, ncid_out, varid_out)
integer, intent( in) :: ncid_in, varid_in
character (len = *), intent( in) :: name
integer, intent( in) :: ncid_out, varid_out
integer :: nf90_copy_att
nf90_copy_att = nf_copy_att(ncid_in, varid_in, name, ncid_out, varid_out)
end function nf90_copy_att
! -------
function nf90_rename_att(ncid, varid, curname, newname)
integer, intent( in) :: ncid, varid
character (len = *), intent( in) :: curname, newname
integer :: nf90_rename_att
nf90_rename_att = nf_rename_att(ncid, varid, curname, newname)
end function nf90_rename_att
! -------
function nf90_del_att(ncid, varid, name)
integer, intent( in) :: ncid, varid
character (len = *), intent( in) :: name
integer :: nf90_del_att
nf90_del_att = nf_del_att(ncid, varid, name)
end function nf90_del_att
! -------
! Attribute inquiry functions
! -------
function nf90_inq_attname(ncid, varid, attnum, name)
integer, intent( in) :: ncid, varid, attnum
character (len = *), intent(out) :: name
integer :: nf90_inq_attname
nf90_inq_attname = nf_inq_attname(ncid, varid, attnum, name)
end function nf90_inq_attname
! -------
function nf90_inquire_attribute(ncid, varid, name, xtype, len, attnum)
integer, intent( in) :: ncid, varid
character (len = *), intent( in) :: name
integer, intent(out), optional :: xtype, len, attnum
integer :: nf90_inquire_attribute
integer :: local_xtype, local_len
! Do we need to worry about not saving the state from this call?
if(present(attnum)) &
nf90_inquire_attribute = nf_inq_attid(ncid, varid, name, attnum)
nf90_inquire_attribute = nf_inq_att(ncid, varid, name, local_xtype, local_len)
if(present(xtype)) xtype = local_xtype
if(present(len )) len = local_len
end function nf90_inquire_attribute
! -------
! Put and get functions; these will get overloaded
! -------
! Text
! -------
function nf90_put_att_text(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
character(len = *), intent( in) :: values
integer :: nf90_put_att_text
nf90_put_att_text = nf_put_att_text(ncid, varid, name, len_trim(values), trim(values))
end function nf90_put_att_text
! -------
function nf90_get_att_text(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
character(len = *), intent(out) :: values
integer :: nf90_get_att_text
values = ' ' !! make sure result will be blank padded
nf90_get_att_text = nf_get_att_text(ncid, varid, name, values)
end function nf90_get_att_text
! -------
! Integer attributes
! -------
function nf90_put_att_onebyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = OneByteInt), dimension(:), intent( in) :: values
integer :: nf90_put_att_onebyteint
nf90_put_att_onebyteint = nf_put_att_int1(ncid, varid, name, nf90_int1, size(values), values)
end function nf90_put_att_onebyteint
! -------
function nf90_put_att_one_onebyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = OneByteInt), intent( in) :: values
integer :: nf90_put_att_one_onebyteint
integer (kind = OneByteInt), dimension(1) :: valuesa
valuesa(1) = values
nf90_put_att_one_onebyteint = nf_put_att_int1(ncid, varid, name, nf90_int1, 1, valuesa)
end function nf90_put_att_one_onebyteint
! -------
function nf90_get_att_onebyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = OneByteInt), dimension(:), intent(out) :: values
integer :: nf90_get_att_onebyteint
nf90_get_att_onebyteint = nf_get_att_int1(ncid, varid, name, values)
end function nf90_get_att_onebyteint
! -------
function nf90_get_att_one_onebyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = OneByteInt), intent(out) :: values
integer :: nf90_get_att_one_onebyteint
integer (kind = OneByteInt), dimension(1) :: valuesa
nf90_get_att_one_onebyteint = nf_get_att_int1(ncid, varid, name, valuesa)
values = valuesa(1)
end function nf90_get_att_one_onebyteint
! -------
function nf90_put_att_twobyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = TwoByteInt), dimension(:), intent( in) :: values
integer :: nf90_put_att_twobyteint
nf90_put_att_twobyteint = nf_put_att_int2(ncid, varid, name, nf90_int2, size(values), values)
end function nf90_put_att_twobyteint
! -------
function nf90_put_att_one_twobyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = TwoByteInt), intent( in) :: values
integer :: nf90_put_att_one_twobyteint
integer (kind = TwoByteInt), dimension(1) :: valuesa
valuesa(1) = values
nf90_put_att_one_twobyteint = nf_put_att_int2(ncid, varid, name, nf90_int2, 1, valuesa)
end function nf90_put_att_one_twobyteint
! -------
function nf90_get_att_twobyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = TwoByteInt), dimension(:), intent(out) :: values
integer :: nf90_get_att_twobyteint
nf90_get_att_twobyteint = nf_get_att_int2(ncid, varid, name, values)
end function nf90_get_att_twobyteint
! -------
function nf90_get_att_one_twobyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = TwoByteInt), intent(out) :: values
integer :: nf90_get_att_one_twobyteint
integer (kind = TwoByteInt), dimension(1) :: valuesa
nf90_get_att_one_twobyteint = nf_get_att_int2(ncid, varid, name, valuesa)
values = valuesa(1)
end function nf90_get_att_one_twobyteint
! -------
function nf90_put_att_fourbyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = FourByteInt), dimension(:), intent( in) :: values
integer :: nf90_put_att_fourbyteint
nf90_put_att_fourbyteint = nf_put_att_int(ncid, varid, name, nf90_int, size(values), int(values))
end function nf90_put_att_fourbyteint
! -------
function nf90_put_att_one_fourbyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = FourByteInt), intent( in) :: values
integer :: nf90_put_att_one_fourbyteint
integer (kind = FourByteInt), dimension(1) :: valuesa
valuesa(1) = int(values)
nf90_put_att_one_fourbyteint = nf_put_att_int(ncid, varid, name, nf90_int, 1, int(valuesa))
end function nf90_put_att_one_fourbyteint
! -------
function nf90_get_att_fourbyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = FourByteInt), dimension(:), intent(out) :: values
integer :: nf90_get_att_fourbyteint
integer, dimension(size(values)) :: defaultinteger
nf90_get_att_fourbyteint = nf_get_att_int(ncid, varid, name, defaultinteger)
values(:) = defaultinteger(:)
end function nf90_get_att_fourbyteint
! -------
function nf90_get_att_one_fourbyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = FourByteInt), intent(out) :: values
integer :: nf90_get_att_one_fourbyteint
integer, dimension(1) :: defaultinteger
nf90_get_att_one_fourbyteint = nf_get_att_int(ncid, varid, name, defaultinteger)
values = defaultinteger(1)
end function nf90_get_att_one_fourbyteint
! -------
function nf90_put_att_eightbyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = EightByteInt), dimension(:), intent( in) :: values
integer :: nf90_put_att_eightbyteint
nf90_put_att_eightbyteint = nf_put_att_int(ncid, varid, name, nf90_int, size(values), int(values))
end function nf90_put_att_eightbyteint
! -------
function nf90_put_att_one_eightbyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = EightByteInt), intent( in) :: values
integer :: nf90_put_att_one_eightbyteint
integer, dimension(1) :: valuesa
valuesa(1) = values
nf90_put_att_one_eightbyteint = nf_put_att_int(ncid, varid, name, nf90_int, 1, valuesa)
end function nf90_put_att_one_eightbyteint
! -------
function nf90_get_att_eightbyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = EightByteInt), dimension(:), intent(out) :: values
integer :: nf90_get_att_eightbyteint
integer, dimension(size(values)) :: defaultinteger
nf90_get_att_eightbyteint = nf_get_att_int(ncid, varid, name, defaultinteger)
values(:) = defaultinteger(:)
end function nf90_get_att_eightbyteint
! -------
function nf90_get_att_one_eightbyteint(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
integer (kind = EightByteInt), intent(out) :: values
integer :: nf90_get_att_one_eightbyteint
integer, dimension(1) :: defaultinteger
nf90_get_att_one_eightbyteint = nf_get_att_int(ncid, varid, name, defaultinteger)
values = defaultinteger(1)
end function nf90_get_att_one_eightbyteint
! -------
! Real attributes
! -------
function nf90_put_att_fourbytereal(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
real (kind = FourByteReal), dimension(:), intent( in) :: values
integer :: nf90_put_att_fourbytereal
nf90_put_att_fourbytereal = nf_put_att_real(ncid, varid, name, nf90_real4, size(values), values)
end function nf90_put_att_fourbytereal
! -------
function nf90_put_att_one_fourbytereal(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
real (kind = FourByteReal), intent( in) :: values
integer :: nf90_put_att_one_fourbytereal
real (kind = FourByteReal), dimension(1) :: valuesa
valuesa(1) = values
nf90_put_att_one_fourbytereal = nf_put_att_real(ncid, varid, name, nf90_real4, 1, valuesa)
end function nf90_put_att_one_fourbytereal
! -------
function nf90_get_att_fourbytereal(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
real (kind = FourByteReal), dimension(:), intent(out) :: values
integer :: nf90_get_att_fourbytereal
nf90_get_att_fourbytereal = nf_get_att_real(ncid, varid, name, values)
end function nf90_get_att_fourbytereal
! -------
function nf90_get_att_one_fourbytereal(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
real (kind = FourByteReal), intent(out) :: values
integer :: nf90_get_att_one_fourbytereal
real (kind = FourByteReal), dimension(1) :: valuesa
nf90_get_att_one_fourbytereal = nf_get_att_real(ncid, varid, name, valuesa)
values = valuesa(1)
end function nf90_get_att_one_fourbytereal
! -------
function nf90_put_att_eightbytereal(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
real (kind = EightByteReal), dimension(:), intent( in) :: values
integer :: nf90_put_att_eightbytereal
nf90_put_att_eightbytereal = nf_put_att_double(ncid, varid, name, nf90_real8, size(values), values)
end function nf90_put_att_eightbytereal
! -------
function nf90_put_att_one_eightbytereal(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
real (kind = EightByteReal), intent( in) :: values
integer :: nf90_put_att_one_eightbytereal
real (kind = EightByteReal), dimension(1) :: valuesa
valuesa(1) = values
nf90_put_att_one_eightbytereal = nf_put_att_double(ncid, varid, name, nf90_real8, 1, valuesa)
end function nf90_put_att_one_eightbytereal
! -------
function nf90_get_att_eightbytereal(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
real (kind = EightByteReal), dimension(:), intent(out) :: values
integer :: nf90_get_att_eightbytereal
nf90_get_att_eightbytereal = nf_get_att_double(ncid, varid, name, values)
end function nf90_get_att_eightbytereal
! -------
function nf90_get_att_one_eightbytereal(ncid, varid, name, values)
integer, intent( in) :: ncid, varid
character(len = *), intent( in) :: name
real (kind = EightByteReal), intent(out) :: values
integer :: nf90_get_att_one_eightbytereal
real (kind = EightByteReal), dimension(1) :: valuesa
nf90_get_att_one_eightbytereal = nf_get_att_double(ncid, varid, name, valuesa)
values = valuesa(1)
end function nf90_get_att_one_eightbytereal
! -------

Return to the Main Unidata NetCDF page.