1 #include "nfconfig.inc"
44 Integer,
Intent(IN) :: ncid, varid
45 Integer,
Intent(IN) :: start(*), counts(*)
46 Character(LEN=*),
Intent(IN) :: text
50 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
51 Type(c_ptr
) :: cstartptr, ccountsptr
54 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
61 cstartptr = c_null_ptr
62 ccountsptr = c_null_ptr
65 If (cstat1 == nc_noerr)
Then
67 ALLOCATE(cstart(ndims))
68 ALLOCATE(ccounts(ndims))
69 cstart(1:ndims) = start(ndims:1:-1) - 1
70 ccounts(1:ndims) = counts(ndims:1:-1)
71 cstartptr = c_loc(cstart)
72 ccountsptr = c_loc(ccounts)
82 cstartptr = c_null_ptr
83 ccountsptr = c_null_ptr
84 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
85 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
97 Integer,
Intent(IN) :: ncid, varid
98 Integer,
Intent(IN) :: start(*), counts(*)
99 Character(LEN=1),
Intent(IN) :: text(*)
103 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
104 Type(c_ptr
) :: cstartptr, ccountsptr
107 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
114 cstartptr = c_null_ptr
115 ccountsptr = c_null_ptr
118 If (cstat1 == nc_noerr)
Then
120 ALLOCATE(cstart(ndims))
121 ALLOCATE(ccounts(ndims))
122 cstart(1:ndims) = start(ndims:1:-1) - 1
123 ccounts(1:ndims) = counts(ndims:1:-1)
124 cstartptr = c_loc(cstart)
125 ccountsptr = c_loc(ccounts)
135 cstartptr = c_null_ptr
136 ccountsptr = c_null_ptr
137 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
138 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
150 Integer,
Intent(IN) :: ncid, varid
151 Integer,
Intent(IN) :: start(*), counts(*)
152 Integer(NFINT1),
Intent(IN) :: i1vals(*)
156 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
157 Type(c_ptr
) :: cstartptr, ccountsptr
160 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
162 If (c_signed_char < 0)
Then
172 cstartptr = c_null_ptr
173 ccountsptr = c_null_ptr
176 If (cstat1 == nc_noerr)
Then
178 ALLOCATE(cstart(ndims))
179 ALLOCATE(ccounts(ndims))
180 cstart(1:ndims) = start(ndims:1:-1) - 1
181 ccounts(1:ndims) = counts(ndims:1:-1)
182 cstartptr = c_loc(cstart)
183 ccountsptr = c_loc(ccounts)
187 #if NF_INT1_IS_C_SIGNED_CHAR
189 #elif NF_INT1_IS_C_SHORT
191 #elif NF_INT1_IS_C_INT
192 cstatus =
nc_put_vara_int(cncid, cvarid, cstartptr, ccountsptr, i1vals)
193 #elif NF_INT1_IS_C_LONG
201 cstartptr = c_null_ptr
202 ccountsptr = c_null_ptr
203 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
204 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
216 Integer,
Intent(IN) :: ncid, varid
217 Integer,
Intent(IN) :: start(*), counts(*)
218 Integer(NFINT2),
Intent(IN) :: i2vals(*)
222 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
223 Type(c_ptr
) :: cstartptr, ccountsptr
226 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
228 If (c_short < 0)
Then
238 cstartptr = c_null_ptr
239 ccountsptr = c_null_ptr
242 If (cstat1 == nc_noerr)
Then
244 ALLOCATE(cstart(ndims))
245 ALLOCATE(ccounts(ndims))
246 cstart(1:ndims) = start(ndims:1:-1) - 1
247 ccounts(1:ndims) = counts(ndims:1:-1)
248 cstartptr = c_loc(cstart)
249 ccountsptr = c_loc(ccounts)
253 #if NF_INT2_IS_C_SHORT
255 #elif NF_INT2_IS_C_INT
256 cstatus =
nc_put_vara_int(cncid, cvarid, cstartptr, ccountsptr, i2vals)
257 #elif NF_INT2_IS_C_LONG
265 cstartptr = c_null_ptr
266 ccountsptr = c_null_ptr
267 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
268 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
280 Integer,
Intent(IN) :: ncid, varid
281 Integer,
Intent(IN) :: start(*), counts(*)
282 Integer(NFINT),
Intent(IN) :: ivals(*)
286 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
287 Type(c_ptr
) :: cstartptr, ccountsptr
290 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
297 cstartptr = c_null_ptr
298 ccountsptr = c_null_ptr
301 If (cstat1 == nc_noerr)
Then
303 ALLOCATE(cstart(ndims))
304 ALLOCATE(ccounts(ndims))
305 cstart(1:ndims) = start(ndims:1:-1) - 1
306 ccounts(1:ndims) = counts(ndims:1:-1)
307 cstartptr = c_loc(cstart)
308 ccountsptr = c_loc(ccounts)
314 #elif NF_INT_IS_C_LONG
322 cstartptr = c_null_ptr
323 ccountsptr = c_null_ptr
324 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
325 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
337 Integer,
Intent(IN) :: ncid, varid
338 Integer,
Intent(IN) :: start(*), counts(*)
339 Real(NFREAL),
Intent(IN) :: rvals(*)
343 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
344 Type(c_ptr
) :: cstartptr, ccountsptr
347 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
354 cstartptr = c_null_ptr
355 ccountsptr = c_null_ptr
358 If (cstat1 == nc_noerr)
Then
360 ALLOCATE(cstart(ndims))
361 ALLOCATE(ccounts(ndims))
362 cstart(1:ndims) = start(ndims:1:-1) - 1
363 ccounts(1:ndims) = counts(ndims:1:-1)
364 cstartptr = c_loc(cstart)
365 ccountsptr = c_loc(ccounts)
369 #if NF_REAL_IS_C_DOUBLE
379 cstartptr = c_null_ptr
380 ccountsptr = c_null_ptr
381 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
382 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
395 Integer,
Intent(IN) :: ncid, varid
396 Integer,
Intent(IN) :: start(*), counts(*)
397 Real(RK8),
Intent(IN) :: dvals(*)
401 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
402 Type(c_ptr
) :: cstartptr, ccountsptr
405 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
412 cstartptr = c_null_ptr
413 ccountsptr = c_null_ptr
416 If (cstat1 == nc_noerr)
Then
418 ALLOCATE(cstart(ndims))
419 ALLOCATE(ccounts(ndims))
420 cstart(1:ndims) = start(ndims:1:-1) - 1
421 ccounts(1:ndims) = counts(ndims:1:-1)
422 cstartptr = c_loc(cstart)
423 ccountsptr = c_loc(ccounts)
433 cstartptr = c_null_ptr
434 ccountsptr = c_null_ptr
435 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
436 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
440 Function nf_put_vara(ncid, varid, start, counts, values) RESULT(status)
450 Integer,
Intent(IN) :: ncid, varid
451 Integer,
Intent(IN) :: start(*), counts(*)
452 Character(KIND=C_CHAR),
Intent(IN),
TARGET :: values(*)
455 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
456 Type(c_ptr
) :: cstartptr, ccountsptr, cvaluesptr
459 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
466 cstartptr = c_null_ptr
467 ccountsptr = c_null_ptr
470 If (cstat1 == nc_noerr)
Then
472 ALLOCATE(cstart(ndims))
473 ALLOCATE(ccounts(ndims))
474 cstart(1:ndims) = start(ndims:1:-1) - 1
475 ccounts(1:ndims) = counts(ndims:1:-1)
476 cstartptr = c_loc(cstart)
477 ccountsptr = c_loc(ccounts)
481 cvaluesptr = c_loc(values)
483 cstatus =
nc_put_vara(cncid, cvarid, cstartptr, ccountsptr, cvaluesptr)
490 cstartptr = c_null_ptr
491 ccountsptr = c_null_ptr
492 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
493 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
505 Integer,
Intent(IN) :: ncid, varid
506 Integer,
Intent(IN) :: start(*), counts(*)
507 Character(LEN=*),
Intent(OUT) :: text
511 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
512 Type(c_ptr
) :: cstartptr, ccountsptr
515 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
519 text = repeat(
" ", len(text))
523 cstartptr = c_null_ptr
524 ccountsptr = c_null_ptr
527 If (cstat1 == nc_noerr)
Then
529 ALLOCATE(cstart(ndims))
530 ALLOCATE(ccounts(ndims))
531 cstart(1:ndims) = start(ndims:1:-1) - 1
532 ccounts(1:ndims) = counts(ndims:1:-1)
533 cstartptr = c_loc(cstart)
534 ccountsptr = c_loc(ccounts)
544 cstartptr = c_null_ptr
545 ccountsptr = c_null_ptr
546 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
547 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
559 Integer,
Intent(IN) :: ncid, varid
560 Integer,
Intent(IN) :: start(*), counts(*)
561 Character(LEN=1),
Intent(OUT) :: text(*)
565 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
566 Type(c_ptr
) :: cstartptr, ccountsptr
569 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
576 cstartptr = c_null_ptr
577 ccountsptr = c_null_ptr
580 If (cstat1 == nc_noerr)
Then
582 ALLOCATE(cstart(ndims))
583 ALLOCATE(ccounts(ndims))
584 cstart(1:ndims) = start(ndims:1:-1) - 1
585 ccounts(1:ndims) = counts(ndims:1:-1)
586 cstartptr = c_loc(cstart)
587 ccountsptr = c_loc(ccounts)
597 cstartptr = c_null_ptr
598 ccountsptr = c_null_ptr
599 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
600 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
612 Integer,
Intent(IN) :: ncid, varid
613 Integer,
Intent(IN) :: start(*), counts(*)
614 Integer(NFINT1),
Intent(OUT) :: i1vals(*)
618 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
619 Type(c_ptr
) :: cstartptr, ccountsptr
622 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
624 If (c_signed_char < 0)
Then
634 cstartptr = c_null_ptr
635 ccountsptr = c_null_ptr
638 If (cstat1 == nc_noerr)
Then
640 ALLOCATE(cstart(ndims))
641 ALLOCATE(ccounts(ndims))
642 cstart(1:ndims) = start(ndims:1:-1) - 1
643 ccounts(1:ndims) = counts(ndims:1:-1)
644 cstartptr = c_loc(cstart)
645 ccountsptr = c_loc(ccounts)
649 #if NF_INT1_IS_C_SIGNED_CHAR
651 #elif NF_INT1_IS_C_SHORT
653 #elif NF_INT1_IS_C_INT
654 cstatus =
nc_get_vara_int(cncid, cvarid, cstartptr, ccountsptr, i1vals)
655 #elif NF_INT1_IS_C_LONG
663 cstartptr = c_null_ptr
664 ccountsptr = c_null_ptr
665 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
666 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
678 Integer,
Intent(IN) :: ncid, varid
679 Integer,
Intent(IN) :: start(*), counts(*)
680 Integer(NFINT2),
Intent(OUT) :: i2vals(*)
684 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
685 Type(c_ptr
) :: cstartptr, ccountsptr
688 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
690 If (c_short < 0)
Then
700 cstartptr = c_null_ptr
701 ccountsptr = c_null_ptr
704 If (cstat1 == nc_noerr)
Then
706 ALLOCATE(cstart(ndims))
707 ALLOCATE(ccounts(ndims))
708 cstart(1:ndims) = start(ndims:1:-1) - 1
709 ccounts(1:ndims) = counts(ndims:1:-1)
710 cstartptr = c_loc(cstart)
711 ccountsptr = c_loc(ccounts)
715 #if NF_INT2_IS_C_SHORT
717 #elif NF_INT2_IS_C_INT
718 cstatus =
nc_get_vara_int(cncid, cvarid, cstartptr, ccountsptr, i2vals)
719 #elif NF_INT2_IS_C_LONG
727 cstartptr = c_null_ptr
728 ccountsptr = c_null_ptr
729 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
730 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
742 Integer,
Intent(IN) :: ncid, varid
743 Integer,
Intent(IN) :: start(*), counts(*)
744 Integer(NFINT),
Intent(OUT) :: ivals(*)
748 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
749 Type(c_ptr
) :: cstartptr, ccountsptr
752 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
759 cstartptr = c_null_ptr
760 ccountsptr = c_null_ptr
763 If (cstat1 == nc_noerr)
Then
765 ALLOCATE(cstart(ndims))
766 ALLOCATE(ccounts(ndims))
767 cstart(1:ndims) = start(ndims:1:-1) - 1
768 ccounts(1:ndims) = counts(ndims:1:-1)
769 cstartptr = c_loc(cstart)
770 ccountsptr = c_loc(ccounts)
776 #elif NF_INT_IS_C_LONG
784 cstartptr = c_null_ptr
785 ccountsptr = c_null_ptr
786 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
787 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
799 Integer,
Intent(IN) :: ncid, varid
800 Integer,
Intent(IN) :: start(*), counts(*)
801 Real(NFREAL),
Intent(OUT) :: rvals(*)
805 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
806 Type(c_ptr
) :: cstartptr, ccountsptr
809 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
816 cstartptr = c_null_ptr
817 ccountsptr = c_null_ptr
820 If (cstat1 == nc_noerr)
Then
822 ALLOCATE(cstart(ndims))
823 ALLOCATE(ccounts(ndims))
824 cstart(1:ndims) = start(ndims:1:-1) - 1
825 ccounts(1:ndims) = counts(ndims:1:-1)
826 cstartptr = c_loc(cstart)
827 ccountsptr = c_loc(ccounts)
831 #if NF_REAL_IS_C_DOUBLE
841 cstartptr = c_null_ptr
842 ccountsptr = c_null_ptr
843 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
844 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
857 Integer,
Intent(IN) :: ncid, varid
858 Integer,
Intent(IN) :: start(*), counts(*)
859 Real(RK8),
Intent(OUT) :: dvals(*)
863 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
864 Type(c_ptr
) :: cstartptr, ccountsptr
867 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
874 cstartptr = c_null_ptr
875 ccountsptr = c_null_ptr
878 If (cstat1 == nc_noerr)
Then
880 ALLOCATE(cstart(ndims))
881 ALLOCATE(ccounts(ndims))
882 cstart(1:ndims) = start(ndims:1:-1) - 1
883 ccounts(1:ndims) = counts(ndims:1:-1)
884 cstartptr = c_loc(cstart)
885 ccountsptr = c_loc(ccounts)
895 cstartptr = c_null_ptr
896 ccountsptr = c_null_ptr
897 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
898 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
902 Function nf_get_vara(ncid, varid, start, counts, values) RESULT(status)
912 Integer,
Intent(IN) :: ncid, varid
913 Integer,
Intent(IN) :: start(*), counts(*)
914 Character(KIND=C_CHAR),
Intent(INOUT),
TARGET :: values(*)
917 Integer(C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
918 Type(c_ptr
) :: cstartptr, ccountsptr
921 Integer(C_SIZE_T),
ALLOCATABLE,
TARGET :: cstart(:), ccounts(:)
928 cstartptr = c_null_ptr
929 ccountsptr = c_null_ptr
932 If (cstat1 == nc_noerr)
Then
934 ALLOCATE(cstart(ndims))
935 ALLOCATE(ccounts(ndims))
936 cstart(1:ndims) = start(ndims:1:-1) - 1
937 ccounts(1:ndims) = counts(ndims:1:-1)
938 cstartptr = c_loc(cstart)
939 ccountsptr = c_loc(ccounts)
943 cstatus =
nc_get_vara(cncid, cvarid, cstartptr, ccountsptr, values)
949 cstartptr = c_null_ptr
950 ccountsptr = c_null_ptr
951 If (
ALLOCATED(ccounts))
DEALLOCATE(ccounts)
952 If (
ALLOCATED(cstart))
DEALLOCATE(cstart)
integer function nf_put_vara_text(ncid, varid, start, counts, text)
integer function nf_put_vara_int2(ncid, varid, start, counts, i2vals)
integer function nf_get_vara_text_a(ncid, varid, start, counts, text)
integer function nf_put_vara_int(ncid, varid, start, counts, ivals)
integer function nf_put_vara_text_a(ncid, varid, start, counts, text)
integer function nf_put_vara_int1(ncid, varid, start, counts, i1vals)
function nf_get_vara_double(ncid, varid, start, counts, dvals)
integer function nf_get_vara(ncid, varid, start, counts, values)
integer function nf_get_vara_int1(ncid, varid, start, counts, i1vals)
integer function nf_get_vara_int2(ncid, varid, start, counts, i2vals)
integer function nf_put_vara(ncid, varid, start, counts, values)
integer function nf_get_vara_text(ncid, varid, start, counts, text)
function nf_put_vara_double(ncid, varid, start, counts, dvals)
integer function nf_get_vara_real(ncid, varid, start, counts, rvals)
integer function nf_put_vara_real(ncid, varid, start, counts, rvals)
integer function nf_get_vara_int(ncid, varid, start, counts, ivals)