gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
Functions/Subroutines
gdncvarputattrint.f90 File Reference

Put integer attribute to a netCDF variable . More...

Go to the source code of this file.

Functions/Subroutines

subroutine gdncvarputattrint (var, name, value, err)
 

Detailed Description

Put integer attribute to a netCDF variable

.

Author
GFD Dennou Club

Definition in file gdncvarputattrint.f90.

Function/Subroutine Documentation

◆ gdncvarputattrint()

subroutine gdncvarputattrint ( type(gd_nc_variable), intent(in)  var,
character(len = *), intent(in)  name,
integer, dimension(:), intent(in)  value,
logical, intent(out), optional  err 
)

Set integer attribute value

Sets an integer attribute on a variable. If the name starts with '+', the attribute is treated as a global attribute. If value array is empty, the attribute is deleted.

Parameters
[in]varVariable handle
[in]nameAttribute name
[in]valueInteger values to set
[out]errError flag (optional)

Definition at line 37 of file gdncvarputattrint.f90.

41 use netcdf, only: &
42 & nf90_put_att, &
43 & nf90_noerr, &
44 & nf90_del_att, &
45 & nf90_global
46 use dc_url, only: gt_plus
47 use dc_error
48 implicit none
49 type(GD_NC_VARIABLE), intent(in):: var
50 character(len = *), intent(in):: name
51 type(GD_NC_VARIABLE_ENTRY):: ent
52 integer, intent(in):: value(:)
53 logical, intent(out), optional:: err
54 integer:: stat
55 continue
56 stat = vtable_lookup(var, ent)
57 if (stat /= nf90_noerr) goto 999
58 if (size(value) == 0) then
59 if (name(1:1) == gt_plus) then
60 stat = nf90_del_att(ent%fileid, nf90_global, name(2:))
61 else
62 stat = nf90_del_att(ent%fileid, ent%varid, name)
63 endif
64 goto 999
65 endif
66 stat = gdncfiledefinemode(ent%fileid)
67 if (stat /= nf90_noerr) goto 999
68 if (name(1:1) == gt_plus) then
69 stat = nf90_put_att(ent%fileid, nf90_global, name(2:), value)
70 else
71 stat = nf90_put_att(ent%fileid, ent%varid, name, value)
72 endif
73999 continue
74 call storeerror(stat, 'GDNcVarPutAttrInt', err)
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
Variable URL string parser.
Definition dc_url.f90:61
character, parameter, public gt_plus
Definition dc_url.f90:109
integer function, public vtable_lookup(var, entry)

References dc_url::gt_plus, dc_error::storeerror(), and gtdata_netcdf_internal::vtable_lookup().

Here is the call graph for this function: