1 #include "nfconfig.inc" 34 Function nf_put_varm_text(ncid, varid, start, counts, strides, maps, &
39 USE netcdf_nc_interfaces
43 Integer,
Intent(IN) :: ncid, varid
44 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
45 Character(LEN=*),
Intent(IN) :: text
49 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
50 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
51 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
52 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
65 cstartptr = c_null_ptr
66 ccountsptr = c_null_ptr
67 cstridesptr = c_null_ptr
71 If (cstat1 == nc_noerr)
Then 73 cstart(1:ndims) = start(ndims:1:-1)-1
74 ccounts(1:ndims) = counts(ndims:1:-1)
75 cstrides(1:ndims) = strides(ndims:1:-1)
76 cmaps(1:ndims) = maps(ndims:1:-1)
78 cstartptr = c_loc(cstart)
79 ccountsptr = c_loc(ccounts)
80 cstridesptr = c_loc(cstrides)
81 cmapsptr = c_loc(cmaps)
85 cstridesptr, cmapsptr, text)
89 End Function nf_put_varm_text
91 Function nf_put_varm_text_a(ncid, varid, start, counts, strides, maps, &
96 USE netcdf_nc_interfaces
100 Integer,
Intent(IN) :: ncid, varid
101 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
102 Character(LEN=1),
Intent(IN) :: text(*)
106 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
107 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
108 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
109 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr,&
122 cstartptr = c_null_ptr
123 ccountsptr = c_null_ptr
124 cstridesptr = c_null_ptr
125 cmapsptr = c_null_ptr
128 If (cstat1 == nc_noerr)
Then 130 cstart(1:ndims) = start(ndims:1:-1)-1
131 ccounts(1:ndims) = counts(ndims:1:-1)
132 cstrides(1:ndims) = strides(ndims:1:-1)
133 cmaps(1:ndims) = maps(ndims:1:-1)
135 cstartptr = c_loc(cstart)
136 ccountsptr = c_loc(ccounts)
137 cstridesptr = c_loc(cstrides)
138 cmapsptr = c_loc(cmaps)
142 cstridesptr, cmapsptr, text)
146 End Function nf_put_varm_text_a
148 Function nf_put_varm_int1(ncid, varid, start, counts, strides, maps, &
149 i1vals) result(status)
153 USE netcdf_nc_interfaces
157 Integer,
Intent(IN) :: ncid, varid
158 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
159 Integer(KIND=NFINT1),
Intent(IN) :: i1vals(*)
163 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
164 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
165 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
166 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr,&
170 If (c_signed_char < 0)
Then 184 cstartptr = c_null_ptr
185 ccountsptr = c_null_ptr
186 cstridesptr = c_null_ptr
187 cmapsptr = c_null_ptr
190 If (cstat1 == nc_noerr)
Then 192 cstart(1:ndims) = start(ndims:1:-1)-1
193 ccounts(1:ndims) = counts(ndims:1:-1)
194 cstrides(1:ndims) = strides(ndims:1:-1)
195 cmaps(1:ndims) = maps(ndims:1:-1)
197 cstartptr = c_loc(cstart)
198 ccountsptr = c_loc(ccounts)
199 cstridesptr = c_loc(cstrides)
200 cmapsptr = c_loc(cmaps)
203 #if NF_INT1_IS_C_SIGNED_CHAR 205 cstridesptr, cmapsptr, i1vals)
206 #elif NF_INT1_IS_C_SHORT 208 cstridesptr, cmapsptr, i1vals)
209 #elif NF_INT1_IS_C_INT 211 cstridesptr, cmapsptr, i1vals)
212 #elif NF_INT1_IS_C_LONG 214 cstridesptr, cmapsptr, i1vals)
219 End Function nf_put_varm_int1
221 Function nf_put_varm_int2(ncid, varid, start, counts, strides, maps, &
222 i2vals) result(status)
226 USE netcdf_nc_interfaces
230 Integer,
Intent(IN) :: ncid, varid
231 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
232 Integer(KIND=NFINT2),
Intent(IN) :: i2vals(*)
236 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
237 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
238 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
239 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
243 If (c_short < 0)
Then 257 cstartptr = c_null_ptr
258 ccountsptr = c_null_ptr
259 cstridesptr = c_null_ptr
260 cmapsptr = c_null_ptr
263 If (cstat1 == nc_noerr)
Then 265 cstart(1:ndims) = start(ndims:1:-1)-1
266 ccounts(1:ndims) = counts(ndims:1:-1)
267 cstrides(1:ndims) = strides(ndims:1:-1)
268 cmaps(1:ndims) = maps(ndims:1:-1)
270 cstartptr = c_loc(cstart)
271 ccountsptr = c_loc(ccounts)
272 cstridesptr = c_loc(cstrides)
273 cmapsptr = c_loc(cmaps)
276 #if NF_INT2_IS_C_SHORT 278 cstridesptr, cmapsptr, i2vals)
279 #elif NF_INT2_IS_C_INT 281 cstridesptr, cmapsptr, i2vals)
282 #elif NF_INT2_IS_C_LONG 284 cstridesptr, cmapsptr, i2vals)
289 End Function nf_put_varm_int2
291 Function nf_put_varm_int(ncid, varid, start, counts, strides, maps, &
292 ivals) result(status)
296 USE netcdf_nc_interfaces
300 Integer,
Intent(IN) :: ncid, varid
301 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
302 Integer(NFINT),
Intent(IN) :: ivals(*)
306 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
307 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
308 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
309 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
322 cstartptr = c_null_ptr
323 ccountsptr = c_null_ptr
324 cstridesptr = c_null_ptr
325 cmapsptr = c_null_ptr
328 If (cstat1 == nc_noerr)
Then 330 cstart(1:ndims) = start(ndims:1:-1)-1
331 ccounts(1:ndims) = counts(ndims:1:-1)
332 cstrides(1:ndims) = strides(ndims:1:-1)
333 cmaps(1:ndims) = maps(ndims:1:-1)
335 cstartptr = c_loc(cstart)
336 ccountsptr = c_loc(ccounts)
337 cstridesptr = c_loc(cstrides)
338 cmapsptr = c_loc(cmaps)
343 cstridesptr, cmapsptr, ivals)
344 #elif NF_INT_IS_C_LONG 346 cstridesptr, cmapsptr, ivals)
351 End Function nf_put_varm_int
353 Function nf_put_varm_real(ncid, varid, start, counts, strides, maps, &
354 rvals) result(status)
358 USE netcdf_nc_interfaces
362 Integer,
Intent(IN) :: ncid, varid
363 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
364 Real(NFREAL),
Intent(IN) :: rvals(*)
368 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
369 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
370 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
371 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
384 cstartptr = c_null_ptr
385 ccountsptr = c_null_ptr
386 cstridesptr = c_null_ptr
387 cmapsptr = c_null_ptr
390 If (cstat1 == nc_noerr)
Then 392 cstart(1:ndims) = start(ndims:1:-1)-1
393 ccounts(1:ndims) = counts(ndims:1:-1)
394 cstrides(1:ndims) = strides(ndims:1:-1)
395 cmaps(1:ndims) = maps(ndims:1:-1)
397 cstartptr = c_loc(cstart)
398 ccountsptr = c_loc(ccounts)
399 cstridesptr = c_loc(cstrides)
400 cmapsptr = c_loc(cmaps)
403 #if NF_REAL_IS_C_DOUBLE 405 cstridesptr, cmapsptr, rvals)
408 cstridesptr, cmapsptr, rvals)
412 End Function nf_put_varm_real
414 Function nf_put_varm_double(ncid, varid, start, counts, strides, maps, &
415 dvals) result(status)
419 USE netcdf_nc_interfaces
423 Integer,
Intent(IN) :: ncid, varid
424 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
425 Real(RK8),
Intent(IN) :: dvals(*)
429 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
430 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
431 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
432 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
445 cstartptr = c_null_ptr
446 ccountsptr = c_null_ptr
447 cstridesptr = c_null_ptr
448 cmapsptr = c_null_ptr
451 If (cstat1 == nc_noerr)
Then 453 cstart(1:ndims) = start(ndims:1:-1)-1
454 ccounts(1:ndims) = counts(ndims:1:-1)
455 cstrides(1:ndims) = strides(ndims:1:-1)
456 cmaps(1:ndims) = maps(ndims:1:-1)
458 cstartptr = c_loc(cstart)
459 ccountsptr = c_loc(ccounts)
460 cstridesptr = c_loc(cstrides)
461 cmapsptr = c_loc(cmaps)
465 cstridesptr, cmapsptr, dvals)
469 End Function nf_put_varm_double
471 Function nf_get_varm_text(ncid, varid, start, counts, strides, maps, &
476 USE netcdf_nc_interfaces
480 Integer,
Intent(IN) :: ncid, varid
481 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
482 Character(LEN=*),
Intent(OUT) :: text
486 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
487 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
488 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
489 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
499 text = repeat(
" ",len(text))
503 cstartptr = c_null_ptr
504 ccountsptr = c_null_ptr
505 cstridesptr = c_null_ptr
506 cmapsptr = c_null_ptr
509 If (cstat1 == nc_noerr)
Then 511 cstart(1:ndims) = start(ndims:1:-1)-1
512 ccounts(1:ndims) = counts(ndims:1:-1)
513 cstrides(1:ndims) = strides(ndims:1:-1)
514 cmaps(1:ndims) = maps(ndims:1:-1)
516 cstartptr = c_loc(cstart)
517 ccountsptr = c_loc(ccounts)
518 cstridesptr = c_loc(cstrides)
519 cmapsptr = c_loc(cmaps)
523 cstridesptr, cmapsptr, text)
527 End Function nf_get_varm_text
529 Function nf_get_varm_text_a(ncid, varid, start, counts, strides, maps, &
534 USE netcdf_nc_interfaces
538 Integer,
Intent(IN) :: ncid, varid
539 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
540 Character(LEN=1),
Intent(OUT) :: text(*)
544 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
545 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
546 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
547 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
560 cstartptr = c_null_ptr
561 ccountsptr = c_null_ptr
562 cstridesptr = c_null_ptr
563 cmapsptr = c_null_ptr
566 If (cstat1 == nc_noerr)
Then 568 cstart(1:ndims) = start(ndims:1:-1)-1
569 ccounts(1:ndims) = counts(ndims:1:-1)
570 cstrides(1:ndims) = strides(ndims:1:-1)
571 cmaps(1:ndims) = maps(ndims:1:-1)
573 cstartptr = c_loc(cstart)
574 ccountsptr = c_loc(ccounts)
575 cstridesptr = c_loc(cstrides)
576 cmapsptr = c_loc(cmaps)
580 cstridesptr, cmapsptr, text)
584 End Function nf_get_varm_text_a
586 Function nf_get_varm_int1(ncid, varid, start, counts, strides, maps, &
587 i1vals) result(status)
591 USE netcdf_nc_interfaces
595 Integer,
Intent(IN) :: ncid, varid
596 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
597 Integer(KIND=NFINT1),
Intent(OUT) :: i1vals(*)
601 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
602 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
603 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
604 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
608 If (c_signed_char < 0)
Then 622 cstartptr = c_null_ptr
623 ccountsptr = c_null_ptr
624 cstridesptr = c_null_ptr
625 cmapsptr = c_null_ptr
628 If (cstat1 == nc_noerr)
Then 630 cstart(1:ndims) = start(ndims:1:-1)-1
631 ccounts(1:ndims) = counts(ndims:1:-1)
632 cstrides(1:ndims) = strides(ndims:1:-1)
633 cmaps(1:ndims) = maps(ndims:1:-1)
635 cstartptr = c_loc(cstart)
636 ccountsptr = c_loc(ccounts)
637 cstridesptr = c_loc(cstrides)
638 cmapsptr = c_loc(cmaps)
641 #if NF_INT1_IS_C_SIGNED_CHAR 643 cstridesptr, cmapsptr, i1vals)
644 #elif NF_INT1_IS_C_SHORT 646 cstridesptr, cmapsptr, i1vals)
647 #elif NF_INT1_IS_C_INT 649 cstridesptr, cmapsptr, i1vals)
650 #elif NF_INT1_IS_C_LONG 652 cstridesptr, cmapsptr, i1vals)
657 End Function nf_get_varm_int1
659 Function nf_get_varm_int2(ncid, varid, start, counts, strides, maps, &
660 i2vals) result(status)
664 USE netcdf_nc_interfaces
668 Integer,
Intent(IN) :: ncid, varid
669 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
670 Integer(KIND=NFINT2),
Intent(OUT) :: i2vals(*)
674 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
675 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
676 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
677 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
681 If (c_short < 0)
Then 695 cstartptr = c_null_ptr
696 ccountsptr = c_null_ptr
697 cstridesptr = c_null_ptr
698 cmapsptr = c_null_ptr
701 If (cstat1 == nc_noerr)
Then 703 cstart(1:ndims) = start(ndims:1:-1)-1
704 ccounts(1:ndims) = counts(ndims:1:-1)
705 cstrides(1:ndims) = strides(ndims:1:-1)
706 cmaps(1:ndims) = maps(ndims:1:-1)
708 cstartptr = c_loc(cstart)
709 ccountsptr = c_loc(ccounts)
710 cstridesptr = c_loc(cstrides)
711 cmapsptr = c_loc(cmaps)
714 #if NF_INT2_IS_C_SHORT 716 cstridesptr, cmapsptr, i2vals)
717 #elif NF_INT2_IS_C_INT 719 cstridesptr, cmapsptr, i2vals)
720 #elif NF_INT2_IS_C_LONG 722 cstridesptr, cmapsptr, i2vals)
727 End Function nf_get_varm_int2
729 Function nf_get_varm_int(ncid, varid, start, counts, strides, maps, &
730 ivals) result(status)
734 USE netcdf_nc_interfaces
738 Integer,
Intent(IN) :: ncid, varid
739 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
740 Integer(NFINT),
Intent(OUT) :: ivals(*)
744 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
745 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
746 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
747 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
760 cstartptr = c_null_ptr
761 ccountsptr = c_null_ptr
762 cstridesptr = c_null_ptr
763 cmapsptr = c_null_ptr
766 If (cstat1 == nc_noerr)
Then 768 cstart(1:ndims) = start(ndims:1:-1)-1
769 ccounts(1:ndims) = counts(ndims:1:-1)
770 cstrides(1:ndims) = strides(ndims:1:-1)
771 cmaps(1:ndims) = maps(ndims:1:-1)
773 cstartptr = c_loc(cstart)
774 ccountsptr = c_loc(ccounts)
775 cstridesptr = c_loc(cstrides)
776 cmapsptr = c_loc(cmaps)
781 cstridesptr, cmapsptr, ivals)
782 #elif NF_INT_IS_C_LONG 784 cstridesptr, cmapsptr, ivals)
789 End Function nf_get_varm_int
791 Function nf_get_varm_real(ncid, varid, start, counts, strides, maps, &
792 rvals) result(status)
796 USE netcdf_nc_interfaces
800 Integer,
Intent(IN) :: ncid, varid
801 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
802 Real(NFREAL),
Intent(OUT) :: rvals(*)
806 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
807 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
808 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
809 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
822 cstartptr = c_null_ptr
823 ccountsptr = c_null_ptr
824 cstridesptr = c_null_ptr
825 cmapsptr = c_null_ptr
828 If (cstat1 == nc_noerr)
Then 830 cstart(1:ndims) = start(ndims:1:-1)-1
831 ccounts(1:ndims) = counts(ndims:1:-1)
832 cstrides(1:ndims) = strides(ndims:1:-1)
833 cmaps(1:ndims) = maps(ndims:1:-1)
835 cstartptr = c_loc(cstart)
836 ccountsptr = c_loc(ccounts)
837 cstridesptr = c_loc(cstrides)
838 cmapsptr = c_loc(cmaps)
841 #if NF_REAL_IS_C_DOUBLE 843 cstridesptr, cmapsptr, rvals)
846 cstridesptr, cmapsptr, rvals)
851 End Function nf_get_varm_real
853 Function nf_get_varm_double(ncid, varid, start, counts, strides, maps, &
854 dvals) result(status)
858 USE netcdf_nc_interfaces
862 Integer,
Intent(IN) :: ncid, varid
863 Integer,
Intent(IN) :: start(*), counts(*), strides(*), maps(*)
864 Real(RK8),
Intent(OUT) :: dvals(*)
868 Integer(KIND=C_INT) :: cncid, cvarid, cndims, cstat1, cstatus
869 Integer(KIND=C_SIZE_T),
TARGET :: cstart(nc_max_dims), ccounts(nc_max_dims)
870 Integer(KIND=C_PTRDIFF_T),
TARGET :: cstrides(nc_max_dims), cmaps(nc_max_dims)
871 Type(c_ptr) :: cstartptr, ccountsptr, cstridesptr, &
884 cstartptr = c_null_ptr
885 ccountsptr = c_null_ptr
886 cstridesptr = c_null_ptr
887 cmapsptr = c_null_ptr
890 If (cstat1 == nc_noerr)
Then 892 cstart(1:ndims) = start(ndims:1:-1)-1
893 ccounts(1:ndims) = counts(ndims:1:-1)
894 cstrides(1:ndims) = strides(ndims:1:-1)
895 cmaps(1:ndims) = maps(ndims:1:-1)
897 cstartptr = c_loc(cstart)
898 ccountsptr = c_loc(ccounts)
899 cstridesptr = c_loc(cstrides)
900 cmapsptr = c_loc(cmaps)
904 cstridesptr, cmapsptr, dvals)
908 End Function nf_get_varm_double