33 Subroutine ncpopt(ncopts)
35 USE netcdf_fortv2_c_interfaces
39 Integer,
Intent(IN) :: ncopts
41 Integer(KIND=C_INT) :: cncopts
49 Subroutine ncgopt(ncopts)
51 USE netcdf_fortv2_c_interfaces
55 Integer,
Intent(INOUT) :: ncopts
57 Integer(KIND=C_INT) :: cncopts
67 Function nccre(filename, cmode, rcode) RESULT(ncid)
69 USE netcdf_fortv2_c_interfaces
73 Character(LEN=*),
Intent(IN) :: filename
74 Integer,
Intent(IN) :: cmode
75 Integer,
Intent(OUT) :: rcode
79 Character(LEN=(LEN(filename)+1)) :: cfilename
81 Integer(KIND=C_INT) :: ccmode, crcode, cncid
90 cfilename = addcnullchar(filename, ilen)
92 cncid =
c_nccre(cfilename(1:ilen+1), ccmode, crcode )
99 Function ncopn(filename, rwmode, rcode) RESULT(ncid)
101 USE netcdf_fortv2_c_interfaces
105 Character(LEN=*),
Intent(IN) :: filename
106 Integer,
Intent(IN) :: rwmode
107 Integer,
Intent(OUT) :: rcode
111 Character(LEN=(LEN(filename)+1)) :: cfilename
113 Integer(KIND=C_INT) :: crwmode, crcode, cncid
122 cfilename = addcnullchar(filename, ilen)
124 cncid =
c_ncopn(cfilename(1:ilen+1), crwmode, crcode )
131 Function ncddef(ncid, dimname, dimlen, rcode) RESULT(ndimid)
133 USE netcdf_fortv2_c_interfaces
137 Character(LEN=*),
Intent(IN) :: dimname
138 Integer,
Intent(IN) :: ncid, dimlen
139 Integer,
Intent(OUT) :: rcode
143 Character(LEN=(LEN(dimname)+1)) :: cdimname
145 Integer(KIND=C_INT) :: cncid, cdimlen, cndimid, crcode
155 cdimname = addcnullchar(dimname, ilen)
157 cndimid =
c_ncddef(cncid, cdimname(1:ilen+1), cdimlen, crcode )
164 Function ncdid(ncid, dimname, rcode) RESULT(ndimid)
166 USE netcdf_fortv2_c_interfaces
170 Character(LEN=*),
Intent(IN) :: dimname
171 Integer,
Intent(IN) :: ncid
172 Integer,
Intent(OUT) :: rcode
176 Character(LEN=(LEN(dimname)+1)) :: cdimname
178 Integer(KIND=C_INT) :: cncid, crcode, cndimid
187 cdimname = addcnullchar(dimname, ilen)
189 cndimid =
c_ncdid(cncid, cdimname(1:ilen+1), crcode )
196 Function ncvdef(ncid, varname, vartype, nvdims, vdims, rcode) RESULT(nvarid)
198 USE netcdf_nc_interfaces
, ONLY : nc_max_dims
199 USE netcdf_fortv2_c_interfaces
203 Character(LEN=*),
Intent(IN) :: varname
204 Integer,
Intent(IN) :: ncid, vartype, nvdims
205 Integer,
Intent(IN) :: vdims(*)
206 Integer,
Intent(OUT) :: rcode
210 Character(LEN=(LEN(varname)+1)) :: cvarname
212 Integer(KIND=C_INT) :: cncid, crcode, cnvdims, cvartype, cnvarid
213 Integer(KIND=C_INT) :: cvdims(nc_max_dims)
231 cvdims(1:nvdims) = vdims(nvdims:1:-1) - 1
234 cnvarid =
c_ncvdef(cncid, cvarname(1:ilen+1), cvartype, &
235 cnvdims, cvdims, crcode )
242 Function ncvid(ncid, varname, rcode) RESULT(nvarid)
244 USE netcdf_fortv2_c_interfaces
248 Character(LEN=*),
Intent(IN) :: varname
249 Integer,
Intent(IN) :: ncid
250 Integer,
Intent(OUT) :: rcode
254 Character(LEN=(LEN(varname)+1)) :: cvarname
256 Integer(KIND=C_INT) :: cncid, crcode, cnvarid
266 cvarname = addcnullchar(varname, ilen)
268 cnvarid =
c_ncvid(cncid, cvarname(1:ilen+1), crcode)
275 Function nctlen(datatype, rcode) RESULT(nvarlen)
277 USE netcdf_fortv2_c_interfaces
281 Integer,
Intent(IN) :: datatype
282 Integer,
Intent(OUT) :: rcode
286 Integer(KIND=C_INT) :: crcode, cnvarlen, cdtype
301 Subroutine ncclos(ncid, rcode)
303 USE netcdf_fortv2_c_interfaces
307 Integer,
Intent(IN) :: ncid
308 Integer,
Intent(OUT) :: rcode
310 Integer(KIND=C_INT) :: crcode, cncid
320 End Subroutine ncclos
322 Subroutine ncredf(ncid, rcode)
324 USE netcdf_fortv2_c_interfaces
328 Integer,
Intent(IN) :: ncid
329 Integer,
Intent(OUT) :: rcode
331 Integer(KIND=C_INT) :: crcode, cncid
341 End Subroutine ncredf
343 Subroutine ncendf(ncid, rcode)
345 USE netcdf_fortv2_c_interfaces
349 Integer,
Intent(IN) :: ncid
350 Integer,
Intent(OUT) :: rcode
352 Integer(KIND=C_INT) :: crcode, cncid
362 End Subroutine ncendf
364 Subroutine ncinq(ncid, ndims, nvars, natts, recdim, rcode)
366 USE netcdf_fortv2_c_interfaces
370 Integer,
Intent(IN) :: ncid
371 Integer,
Intent(OUT) :: ndims, nvars, natts, recdim, rcode
373 Integer(KIND=C_INT) :: crcode, cncid, cndims, cnvars, cnatts, crecdim
385 Call c_ncinq(cncid, cndims, cnvars, cnatts, crecdim, crcode)
390 If (crecdim == -1)
Then
400 Subroutine ncsnc(ncid, rcode)
402 USE netcdf_fortv2_c_interfaces
406 Integer,
Intent(IN) :: ncid
407 Integer,
Intent(OUT) :: rcode
409 Integer(KIND=C_INT) :: crcode, cncid
421 Subroutine ncabor(ncid, rcode)
423 USE netcdf_fortv2_c_interfaces
427 Integer,
Intent(IN) :: ncid
428 Integer,
Intent(OUT) :: rcode
430 Integer(KIND=C_INT) :: crcode, cncid
440 End Subroutine ncabor
442 Subroutine ncdinq(ncid, dimid, dimname, dimlen, rcode)
444 USE netcdf_nc_interfaces
, ONLY: nc_max_name
445 USE netcdf_fortv2_c_interfaces
449 Integer,
Intent(IN) :: ncid, dimid
450 Character(LEN=*),
Intent(OUT) :: dimname
451 Integer,
Intent(OUT) :: dimlen, rcode
453 Integer(KIND=C_INT) :: cncid, crcode, cdimlen, cdimid
454 Character(LEN=(NC_MAX_NAME+1)) :: cdimname
462 cdimname = repeat(
" ", len(cdimname))
465 Call c_ncdinq(cncid, cdimid, cdimname, cdimlen, crcode)
474 End Subroutine ncdinq
476 Subroutine ncdren(ncid, dimid, dimname, rcode)
478 USE netcdf_fortv2_c_interfaces
482 Character(LEN=*),
Intent(IN) :: dimname
483 Integer,
Intent(IN) :: ncid, dimid
484 Integer,
Intent(OUT) :: rcode
486 Character(LEN=(LEN(dimname)+1)) :: cdimname
487 Integer(KIND=C_INT) :: cncid, crcode, cdimid
497 cdimname = addcnullchar(dimname, ilen)
499 Call c_ncdren(cncid, cdimid, cdimname(1:ilen+1), crcode)
503 End Subroutine ncdren
505 Subroutine ncvinq(ncid, varid, varname, vartype, nvdims, vdims, &
508 USE netcdf_nc_interfaces
, ONLY: nc_max_dims, nc_max_name
509 USE netcdf_fortv2_c_interfaces
513 Integer,
Intent(IN) :: ncid, varid
514 Character(LEN=*),
Intent(INOUT) :: varname
515 Integer,
Intent(OUT) :: vartype, nvdims, nvatts, rcode
516 Integer,
Intent(INOUT) :: vdims(*)
518 Integer(KIND=C_INT) :: cncid, crcode, cvarid, cvartype, cnvdims, &
520 Integer(KIND=C_INT) :: cvdims(nc_max_dims)
521 Character(LEN=NC_MAX_NAME+1) :: cvarname
537 cvarname = repeat(
" ", len(cvarname))
540 Call c_ncvinq(cncid, cvarid, cvarname, cvartype, cnvdims, cvdims, cnvatts, &
556 vdims(1:nvdims) = cvdims(nvdims:1:-1) + 1
559 End Subroutine ncvinq
561 Subroutine ncvpt1(ncid, varid, mindex, values, rcode)
564 USE netcdf_fortv2_c_interfaces
568 Integer,
Intent(IN) :: ncid, varid
569 Integer,
Intent(IN) :: mindex(*)
570 Character(KIND=C_CHAR),
Intent(IN),
TARGET :: values(*)
571 Integer,
Intent(OUT) :: rcode
573 Integer(KIND=C_INT) :: cncid, crcode, cvarid, cstatus, cndims
574 Integer(KIND=C_SIZE_T),
TARGET :: cmindex(nc_max_dims)
575 Type(c_ptr) :: cmindexptr
576 Type(c_ptr) :: cvaluesptr
589 cmindexptr = c_null_ptr
592 If (cstatus == nc_noerr)
Then
594 cmindex(1:ndims) = mindex(ndims:1:-1) - 1
596 cmindexptr = c_loc(cmindex)
599 cvaluesptr = c_loc(values)
601 Call c_ncvpt1(cncid, cvarid, cmindexptr, cvaluesptr, crcode)
605 End Subroutine ncvpt1
607 Subroutine ncvp1c(ncid, varid, mindex, strings, rcode)
610 USE netcdf_fortv2_c_interfaces
614 Integer,
Intent(IN) :: ncid, varid
615 Integer,
Intent(IN) :: mindex(*)
616 Character(LEN=*),
Intent(IN) :: strings
617 Integer,
Intent(OUT) :: rcode
619 Integer(KIND=C_INT) :: cncid, crcode, cvarid, cstatus, cndims
620 Integer(KIND=C_SIZE_T),
TARGET :: cmindex(nc_max_dims)
621 Type(c_ptr) :: cmindexptr
634 cmindexptr = c_null_ptr
637 If (cstatus == nc_noerr)
Then
639 cmindex(1:ndims) = mindex(ndims:1:-1) - 1
641 cmindexptr = c_loc(cmindex)
644 Call c_ncvp1c(cncid, cvarid, cmindexptr, strings, crcode)
648 End Subroutine ncvp1c
650 Subroutine ncvpt(ncid, varid, start, counts, values, rcode)
653 USE netcdf_fortv2_c_interfaces
657 Integer,
Intent(IN) :: ncid, varid
658 Integer,
Intent(IN) :: start(*), counts(*)
659 Character(KIND=C_CHAR),
Intent(IN),
TARGET :: values(*)
660 Integer,
Intent(OUT) :: rcode
662 Integer(KIND=C_INT) :: cncid, crcode, cvarid, cstatus, cndims
663 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
664 Type(c_ptr) :: cstartptr, ccountsptr
665 Type(c_ptr) :: cvaluesptr
679 cstartptr = c_null_ptr
680 ccountsptr = c_null_ptr
683 If (cstatus == nc_noerr)
Then
685 cstart(1:ndims) = start(ndims:1:-1) - 1
686 ccounts(1:ndims) = counts(ndims:1:-1)
688 cstartptr = c_loc(cstart)
689 ccountsptr = c_loc(ccounts)
692 cvaluesptr = c_loc(values)
694 Call c_ncvpt(cncid, cvarid, cstartptr, ccountsptr, cvaluesptr, crcode)
700 Subroutine ncvptc(ncid, varid, start, counts, strings, lenstr, rcode)
703 USE netcdf_fortv2_c_interfaces
707 Integer,
Intent(IN) :: ncid, varid, lenstr
708 Integer,
Intent(IN) :: start(*), counts(*)
709 Character(LEN=*),
Intent(INOUT) :: strings
710 Integer,
Intent(OUT) :: rcode
712 Integer(KIND=C_INT) :: cncid, crcode, cvarid, cstatus, cndims, &
714 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
715 Type(c_ptr) :: cstartptr, ccountsptr
730 cstartptr = c_null_ptr
731 ccountsptr = c_null_ptr
734 If (cstatus == nc_noerr)
Then
736 cstart(1:ndims) = start(ndims:1:-1) - 1
737 ccounts(1:ndims) = counts(ndims:1:-1)
739 cstartptr = c_loc(cstart)
740 ccountsptr = c_loc(ccounts)
743 Call c_ncvptc(cncid, cvarid, cstartptr, ccountsptr, strings(1:lenstr),&
748 End Subroutine ncvptc
750 Subroutine ncvptg(ncid, varid, start, counts, strides, imap, values, &
754 USE netcdf_fortv2_c_interfaces
758 Integer,
Intent(IN) :: ncid, varid
759 Integer,
Intent(IN) :: start(*), counts(*), &
761 Character(KIND=C_CHAR),
Intent(IN),
TARGET :: values(*)
762 Integer,
Intent(OUT) :: rcode
764 Integer(KIND=C_INT) :: cncid, crcode, cvarid, cstatus, cndims
765 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
766 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cimap(nc_max_dims)
767 Type(c_ptr) :: cstartptr, ccountsptr, cimapptr, &
769 Type(c_ptr) :: cvaluesptr
770 Integer :: ndims, inullp
782 Call convert_v2_imap(cncid, cvarid, imap, cimap, inullp)
787 cstartptr = c_null_ptr
788 ccountsptr = c_null_ptr
789 cstridesptr = c_null_ptr
790 cimapptr = c_loc(cimap)
791 If (inullp /= 0) cimapptr = c_null_ptr
793 If (cstatus == nc_noerr)
Then
795 cstart(1:ndims) = start(ndims:1:-1) - 1
796 ccounts(1:ndims) = counts(ndims:1:-1)
797 cstrides(1:ndims) = strides(ndims:1:-1) - 1
799 cstartptr = c_loc(cstart)
800 ccountsptr = c_loc(ccounts)
801 cstridesptr = c_loc(cstrides)
804 cvaluesptr = c_loc(values)
806 Call c_ncvptg(cncid, cvarid, cstartptr, ccountsptr, cstridesptr, &
807 cimapptr, cvaluesptr, crcode)
811 End Subroutine ncvptg
813 Subroutine ncvpgc(ncid, varid, start, counts, strides, imap, string, rcode)
816 USE netcdf_fortv2_c_interfaces
820 Integer,
Intent(IN) :: ncid, varid
821 Integer,
Intent(IN) :: start(*), counts(*), strides(*), imap(*)
822 Character(LEN=*),
Intent(IN) :: string
823 Integer,
Intent(OUT) :: rcode
825 Integer(KIND=C_INT) :: cncid, crcode, cvarid, cstatus, cndims
826 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
827 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cimap(nc_max_dims)
828 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
830 Integer :: ndims, inullp
842 Call convert_v2_imap(cncid, cvarid, imap, cimap, inullp)
847 cstartptr = c_null_ptr
848 ccountsptr = c_null_ptr
849 cstridesptr = c_null_ptr
850 cimapptr = c_loc(cimap)
851 If (inullp /= 0) cimapptr = c_null_ptr
853 If (cstatus == nc_noerr)
Then
855 cstart(1:ndims) = start(ndims:1:-1) - 1
856 ccounts(1:ndims) = counts(ndims:1:-1)
857 cstrides(1:ndims) = strides(ndims:1:-1) - 1
859 cstartptr = c_loc(cstart)
860 ccountsptr = c_loc(ccounts)
861 cstridesptr = c_loc(cstrides)
864 Call c_ncvpgc(cncid, cvarid, cstartptr, ccountsptr, cstridesptr, &
865 cimapptr, string, crcode)
869 End Subroutine ncvpgc
871 Subroutine ncvgt1(ncid, varid, mindex, values, rcode)
874 USE netcdf_fortv2_c_interfaces
878 Integer,
Intent(IN) :: ncid, varid
879 Integer,
Intent(IN) :: mindex(*)
880 Character(KIND=C_CHAR),
Intent(OUT) :: values(*)
881 Integer,
Intent(OUT) :: rcode
883 Integer(KIND=C_INT) :: cncid, crcode, cvarid, cstatus, cndims
884 Integer(KIND=C_SIZE_T),
TARGET :: cmindex(nc_max_dims)
885 Type(c_ptr) :: cmindexptr
898 cmindexptr = c_null_ptr
901 If (cstatus == nc_noerr)
Then
903 cmindex(1:ndims) = mindex(ndims:1:-1) - 1
905 cmindexptr = c_loc(cmindex)
908 Call c_ncvgt1(cncid, cvarid, cmindexptr, values, crcode)
912 End Subroutine ncvgt1
914 Subroutine ncvg1c(ncid, varid, mindex, string, rcode)
917 USE netcdf_fortv2_c_interfaces
921 Integer,
Intent(IN) :: ncid, varid
922 Integer,
Intent(IN) :: mindex(*)
923 Character(LEN=*),
Intent(INOUT) :: string
924 Integer,
Intent(OUT) :: rcode
926 Integer(KIND=C_INT) :: cncid, crcode, cvarid, cstatus, cndims
927 Integer(KIND=C_SIZE_T),
TARGET :: cmindex(nc_max_dims)
928 Type(c_ptr) :: cmindexptr
941 cmindexptr = c_null_ptr
944 If (cstatus == nc_noerr)
Then
946 cmindex(1:ndims) = mindex(ndims:1:-1) - 1
948 cmindexptr = c_loc(cmindex)
951 Call c_ncvg1c(cncid, cvarid, cmindexptr, string, crcode)
955 End Subroutine ncvg1c
957 Subroutine ncvgt(ncid, varid, start, counts, values, rcode)
960 USE netcdf_fortv2_c_interfaces
964 Integer,
Intent(IN) :: ncid, varid
965 Integer,
Intent(IN) :: start(*), counts(*)
966 Character(KIND=C_CHAR),
Intent(OUT) :: values(*)
967 Integer,
Intent(OUT) :: rcode
969 Integer(KIND=C_INT) :: cncid, crcode, cvarid, cstatus, cndims
970 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
971 Type(c_ptr) :: cstartptr, ccountsptr
985 cstartptr = c_null_ptr
986 ccountsptr = c_null_ptr
989 If (cstatus == nc_noerr)
Then
991 cstart(1:ndims) = start(ndims:1:-1) - 1
992 ccounts(1:ndims) = counts(ndims:1:-1)
994 cstartptr = c_loc(cstart)
995 ccountsptr = c_loc(ccounts)
998 Call c_ncvgt(cncid, cvarid, cstartptr, ccountsptr, values, crcode)
1002 End Subroutine ncvgt
1004 Subroutine ncvgtc(ncid, varid, start, counts, string, lenstr, rcode)
1006 USE netcdf_nc_interfaces
, ONLY: nc_max_dims, nc_noerr,
nc_inq_varndims
1007 USE netcdf_fortv2_c_interfaces
1011 Integer,
Intent(IN) :: ncid, varid, lenstr
1012 Integer,
Intent(IN) :: start(*), counts(*)
1013 Character(LEN=*),
Intent(INOUT) :: string
1014 Integer,
Intent(OUT) :: rcode
1016 Integer(KIND=C_INT) :: cncid, crcode, cvarid, cstatus, cndims, &
1018 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
1019 Type(c_ptr) :: cstartptr, ccountsptr
1020 Character(LEN=lenstr+1) :: cstring
1021 Integer :: ndims, slen
1032 string = repeat(
" ", len(string))
1033 cstring = repeat(
" ", len(cstring))
1037 cstartptr = c_null_ptr
1038 ccountsptr = c_null_ptr
1041 If (cstatus == nc_noerr)
Then
1043 cstart(1:ndims) = start(ndims:1:-1) - 1
1044 ccounts(1:ndims) = counts(ndims:1:-1)
1046 cstartptr = c_loc(cstart)
1047 ccountsptr = c_loc(ccounts)
1050 Call c_ncvgtc(cncid, cvarid, cstartptr, ccountsptr, cstring, clenstr, crcode)
1052 If (len(string) >= lenstr)
Then
1053 string(1:lenstr) = cstring(1:lenstr)
1056 string(1:slen) = cstring(1:slen)
1061 End Subroutine ncvgtc
1063 Subroutine ncvgtg(ncid, varid, start, counts, strides, imap, values, &
1066 USE netcdf_nc_interfaces
, ONLY: nc_max_dims, nc_noerr,
nc_inq_varndims
1067 USE netcdf_fortv2_c_interfaces
1071 Integer,
Intent(IN) :: ncid, varid
1072 Integer,
Intent(IN) :: start(*), counts(*), strides(*), imap(*)
1073 Character(KIND=C_CHAR),
Intent(OUT) :: values(*)
1074 Integer,
Intent(OUT) :: rcode
1076 Integer(KIND=C_INT) :: cncid, crcode, cvarid, cstatus, cndims
1077 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
1078 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cimap(nc_max_dims)
1079 Type(c_ptr) :: cstartptr, ccountsptr, cimapptr, &
1081 Integer :: ndims, inullp
1092 Call convert_v2_imap(cncid, cvarid, imap, cimap, inullp)
1095 cstartptr = c_null_ptr
1096 ccountsptr = c_null_ptr
1097 cstridesptr = c_null_ptr
1098 cimapptr = c_loc(cimap)
1100 If (inullp /= 0) cimapptr = c_null_ptr
1102 If (cstatus == nc_noerr)
Then
1104 cstart(1:ndims) = start(ndims:1:-1) - 1
1105 ccounts(1:ndims) = counts(ndims:1:-1)
1106 cstrides(1:ndims) = strides(ndims:1:-1) - 1
1108 cstartptr = c_loc(cstart)
1109 ccountsptr = c_loc(ccounts)
1110 cstridesptr = c_loc(cstrides)
1113 Call c_ncvgtg(cncid, cvarid, cstartptr, ccountsptr, cstridesptr, &
1114 cimapptr, values, crcode)
1118 End Subroutine ncvgtg
1120 Subroutine ncvggc(ncid, varid, start, counts, strides, imap, string, rcode)
1122 USE netcdf_nc_interfaces
, ONLY: nc_max_dims, nc_noerr,
nc_inq_varndims
1123 USE netcdf_fortv2_c_interfaces
1127 Integer,
Intent(IN) :: ncid, varid
1128 Integer,
Intent(IN) :: start(*), counts(*), strides(*), imap(*)
1129 Character(LEN=*),
Intent(INOUT) :: string
1130 Integer,
Intent(OUT) :: rcode
1132 Integer(KIND=C_INT) :: cncid, crcode, cvarid, cstatus, cndims
1133 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
1134 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cimap(nc_max_dims)
1135 Character(LEN=(LEN(string)+1)) :: cstring
1136 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
1138 Integer :: ndims, inullp,slen
1149 string = repeat(
" ", len(string))
1150 cstring = repeat(
" ", len(cstring))
1152 Call convert_v2_imap(cncid, cvarid, imap, cimap, inullp)
1156 cstartptr = c_null_ptr
1157 ccountsptr = c_null_ptr
1158 cstridesptr = c_null_ptr
1159 cimapptr = c_loc(cimap)
1161 If (inullp /= 0) cimapptr = c_null_ptr
1163 If (cstatus == nc_noerr)
Then
1165 cstart(1:ndims) = start(ndims:1:-1) - 1
1166 ccounts(1:ndims) = counts(ndims:1:-1)
1167 cstrides(1:ndims) = strides(ndims:1:-1) - 1
1169 cstartptr = c_loc(cstart)
1170 ccountsptr = c_loc(ccounts)
1171 cstridesptr = c_loc(cstrides)
1174 Call c_ncvggc(cncid, cvarid, cstartptr, ccountsptr, cstridesptr, &
1175 cimapptr, cstring, crcode)
1178 string(1:slen) = cstring(1:slen)
1182 End Subroutine ncvggc
1184 Subroutine ncvren(ncid, varid, newnam, rcode)
1186 USE netcdf_fortv2_c_interfaces
1190 Character(LEN=*),
Intent(IN) :: newnam
1191 Integer,
Intent(IN) :: ncid, varid
1192 Integer,
Intent(OUT) :: rcode
1194 Character(LEN=(LEN(newnam)+1)) :: cnewnam
1195 Integer(KIND=C_INT) :: cncid, cvarid, crcode
1204 cnewnam = addcnullchar(newnam, ilen)
1206 Call c_ncvren(cncid, cvarid, cnewnam(1:ilen+1), crcode )
1210 End Subroutine ncvren
1212 Subroutine ncapt(ncid, varid, attnam, attype, attlen, value, rcode)
1214 USE netcdf_fortv2_c_interfaces
1218 Character(LEN=*),
Intent(IN) :: attnam
1219 Integer,
Intent(IN) :: ncid, varid, attype, attlen
1220 Character(KIND=C_CHAR),
Intent(IN),
TARGET ::
value(*)
1221 Integer,
Intent(OUT) :: rcode
1223 Integer(KIND=C_INT) :: cncid, cvarid, cattype, crcode
1224 Integer(KIND=C_SIZE_T) :: cattlen
1225 Type(c_ptr) :: cvalueptr
1226 Character(LEN=(LEN(attnam)+1)) :: cattnam
1237 cattnam = addcnullchar(attnam, ilen)
1239 cvalueptr = c_loc(
value)
1241 Call c_ncapt(cncid, cvarid, cattnam(1:ilen+1), cattype, &
1242 cattlen, cvalueptr, crcode )
1246 End Subroutine ncapt
1248 Subroutine ncaptc(ncid, varid, attnam, attype, lenstr, string, rcode)
1250 USE netcdf_fortv2_c_interfaces
1254 Character(LEN=*),
Intent(IN) :: attnam
1255 Integer,
Intent(IN) :: ncid, varid, attype, lenstr
1256 Character(LEN=*),
Intent(IN) :: string
1257 Integer,
Intent(OUT) :: rcode
1259 Integer(KIND=C_INT) :: cncid, cvarid, cattype, crcode
1260 Integer(KIND=C_SIZE_T) :: clenstr
1261 Character(LEN=(LEN(attnam)+1)) :: cattnam
1272 cattnam = addcnullchar(attnam, ilen)
1274 Call c_ncaptc(cncid, cvarid, cattnam(1:ilen+1), cattype, &
1275 clenstr, string, crcode )
1279 End Subroutine ncaptc
1281 Subroutine ncainq(ncid, varid, attnam, attype, attlen, rcode)
1283 USE netcdf_fortv2_c_interfaces
1287 Character(LEN=*),
Intent(IN) :: attnam
1288 Integer,
Intent(IN) :: ncid, varid
1289 Integer,
Intent(OUT) :: attype, attlen, rcode
1291 Integer(KIND=C_INT) :: cncid, cvarid, cattype, crcode, cattlen
1292 Character(LEN=(LEN(attnam)+1)) :: cattnam
1303 cattnam = addcnullchar(attnam, ilen)
1305 Call c_ncainq(cncid, cvarid, cattnam(1:ilen+1), cattype, &
1312 End Subroutine ncainq
1314 Subroutine ncagt(ncid, varid, attnam, values, rcode)
1316 USE netcdf_fortv2_c_interfaces
1320 Character(LEN=*),
Intent(IN) :: attnam
1321 Integer,
Intent(IN) :: ncid, varid
1322 Character(KIND=C_CHAR),
Intent(OUT) :: values(*)
1323 Integer,
Intent(OUT) :: rcode
1325 Integer(KIND=C_INT) :: cncid, cvarid, crcode
1326 Character(LEN=(LEN(attnam)+1)) :: cattnam
1335 cattnam = addcnullchar(attnam, ilen)
1337 Call c_ncagt(cncid, cvarid, cattnam(1:ilen+1), values, crcode)
1341 End Subroutine ncagt
1343 Subroutine ncagtc(ncid, varid, attnam, string, lenstr, rcode)
1345 USE netcdf_fortv2_c_interfaces
1349 Character(LEN=*),
Intent(IN) :: attnam
1350 Integer,
Intent(IN) :: ncid, varid, lenstr
1351 Character(LEN=*),
Intent(INOUT) :: string
1352 Integer,
Intent(OUT) :: rcode
1354 Integer(KIND=C_INT) :: cncid, cvarid, crcode
1355 Character(LEN=(LEN(attnam)+1)) :: cattnam
1356 Character(LEN=(lenstr+1)) :: cstring
1362 string = repeat(
" ", len(string))
1363 cstring = repeat(
" ", len(cstring))
1367 cattnam = addcnullchar(attnam, ilen)
1369 Call c_ncagtc(cncid, cvarid, cattnam(1:ilen+1), cstring, lenstr, &
1372 string(1:lenstr) = cstring(1:lenstr)
1376 End Subroutine ncagtc
1378 Subroutine ncacpy(ncid, varid, attnam, outcdf, outvar, rcode)
1380 USE netcdf_fortv2_c_interfaces
1384 Character(LEN=*),
Intent(IN) :: attnam
1385 Integer,
Intent(IN) :: ncid, varid, outcdf, outvar
1386 Integer,
Intent(OUT) :: rcode
1388 Integer(KIND=C_INT) :: cncid, cvarid, coutcdf, coutvar, crcode
1389 Character(LEN=(LEN(attnam)+1)) :: cattnam
1400 cattnam = addcnullchar(attnam, ilen)
1402 Call c_ncacpy(cncid, cvarid, cattnam(1:ilen+1), coutcdf, &
1407 End Subroutine ncacpy
1409 Subroutine ncanam(ncid, varid, attnum, attnam, rcode)
1411 USE netcdf_nc_interfaces
, ONLY: nc_max_name
1412 USE netcdf_fortv2_c_interfaces
1416 Character(LEN=*),
Intent(INOUT) :: attnam
1417 Integer,
Intent(IN) :: ncid, varid, attnum
1418 Integer,
Intent(OUT) :: rcode
1421 Integer(KIND=C_INT) :: cncid, cvarid, cattnum, crcode
1422 Character(LEN=NC_MAX_NAME+1) :: cattnam
1426 cattnum = attnum - 1
1428 cattnam = repeat(
" ", len(cattnam))
1431 Call c_ncanam(cncid, cvarid, cattnum, cattnam, crcode)
1439 End Subroutine ncanam
1441 Subroutine ncaren(ncid, varid, attnam, newnam, rcode)
1443 USE netcdf_fortv2_c_interfaces
1447 Character(LEN=*),
Intent(IN) :: attnam, newnam
1448 Integer,
Intent(IN) :: ncid, varid
1449 Integer,
Intent(OUT) :: rcode
1451 Integer(KIND=C_INT) :: cncid, cvarid, crcode
1452 Character(LEN=(LEN(attnam)+1)) :: cattnam
1453 Character(LEN=(LEN(newnam)+1)) :: cnewnam
1454 Integer :: ilen, ilen2
1462 cattnam = addcnullchar(attnam, ilen)
1464 cnewnam = addcnullchar(newnam, ilen2)
1466 Call c_ncaren(cncid, cvarid, cattnam(1:ilen+1), cnewnam(1:ilen2+1), crcode)
1470 End Subroutine ncaren
1472 Subroutine ncadel(ncid, varid, attnam, rcode)
1474 USE netcdf_fortv2_c_interfaces
1478 Character(LEN=*),
Intent(IN) :: attnam
1479 Integer,
Intent(IN) :: ncid, varid
1480 Integer,
Intent(OUT) :: rcode
1482 Integer(KIND=C_INT) :: cncid, cvarid, crcode
1483 Character(LEN=(LEN(attnam)+1)) :: cattnam
1492 cattnam = addcnullchar(attnam, ilen)
1494 Call c_ncadel(cncid, cvarid, cattnam(1:ilen+1),crcode)
1498 End Subroutine ncadel
1500 Function ncsfil(ncid, fillmode, rcode) RESULT(currentmode)
1502 USE netcdf_fortv2_c_interfaces
1506 Integer,
Intent(IN) :: ncid, fillmode
1507 Integer,
Intent(OUT) :: rcode
1509 Integer :: currentmode
1511 Integer(KIND=C_INT) :: cncid, cfillmode, crcode, cstatus
1514 cfillmode = fillmode
1516 cstatus =
c_ncsfil(cncid, cfillmode, crcode)
1518 currentmode = cstatus
module procedure interfaces for utility routines