Tests.f90 provides Fortran code examples for many XMDF APIs.
5 CHARACTER(LEN=*),
PARAMETER :: datasets_location =
'Datasets'
6 CHARACTER(LEN=*),
PARAMETER :: scalar_a_location =
'Scalars/ScalarA'
7 CHARACTER(LEN=*),
PARAMETER :: scalar_a_location_full =
'Datasets/Scalars/ScalarA'
8 CHARACTER(LEN=*),
PARAMETER :: scalar_b_location =
'Scalars/ScalarB'
9 CHARACTER(LEN=*),
PARAMETER :: vector2d_a_location =
'Vectors/Vector2D_A'
10 CHARACTER(LEN=*),
PARAMETER :: vector2d_b_location =
'Vectors/Vector2D_B'
18 SUBROUTINE td_edit_scalar_a_values(a_Filename, a_Compression, error)
19 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
20 INTEGER,
INTENT(IN) :: a_compression
21 INTEGER,
INTENT(OUT) :: error
22 INTEGER xfileid, xscalarid
23 INTEGER,
PARAMETER :: editnumvalues = 3
25 INTEGER,
DIMENSION(editNumValues) :: indices
26 REAL,
DIMENSION(editNumValues) :: new_values
28 CALL td_write_scalar_a(a_filename, a_compression, error)
34 CALL xf_open_file(a_filename, .false., xfileid, error)
39 CALL xf_open_group(xfileid, scalar_a_location_full, xscalarid, error);
41 CALL xf_close_file(xfileid, error)
53 new_values(3) = 400.0;
55 CALL xf_change_scalar_values_timestep_float(xscalarid, edittimestep, editnumvalues, &
56 indices, new_values, error)
58 CALL xf_close_group(xscalarid, error)
59 CALL xf_close_file(xfileid, error)
87 new_values(3) = 6000.0
89 CALL xf_change_scalar_values_timestep_float(xscalarid, edittimestep, editnumvalues, &
90 indices, new_values, error)
92 CALL xf_close_group(xscalarid, error)
93 CALL xf_close_file(xfileid, error)
97 CALL xf_close_group(xscalarid, error)
98 CALL xf_close_file(xfileid, error)
109 SUBROUTINE td_read_scalar_a_indices (a_Filename, a_nIndices, a_indices, error)
110 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
111 INTEGER,
INTENT(IN) :: a_nindices
112 INTEGER,
DIMENSION(*),
INTENT(IN) :: a_indices
113 INTEGER,
INTENT(OUT) :: error
114 INTEGER xfileid, xdsetsid, xscalaraid
116 REAL,
ALLOCATABLE,
DIMENSION(:) :: fvalues
121 CALL xf_open_file(a_filename, .true., xfileid, error)
127 CALL xf_open_group(xfileid, datasets_location, xdsetsid, error)
129 CALL xf_open_group(xdsetsid, scalar_a_location, xscalaraid, error)
136 CALL xf_get_dataset_num_times(xscalaraid, ntimesteps, error)
140 if (ntimesteps < 1)
then
146 nvalues = ntimesteps*a_nindices
147 allocate(fvalues(nvalues))
148 CALL xf_read_scalar_values_at_indices_float(xscalaraid, a_nindices, a_indices, 1, &
149 ntimesteps, fvalues, error)
156 WRITE(*,*)
'Reading scalar A indices'
159 WRITE(*,*)
'Timestep: ', i
161 WRITE(*,*)
'index:', a_indices(j),
' value: ', fvalues(id)
180 RECURSIVE SUBROUTINE td_read_datasets (a_xGroupId, a_FileUnit, error)
181 INTEGER,
INTENT(IN) :: a_xgroupid
182 INTEGER,
INTENT(IN) :: a_fileunit
183 INTEGER,
INTENT(OUT) :: error
184 INTEGER npaths, nmaxpathlength, j
185 CHARACTER,
ALLOCATABLE,
DIMENSION(:) :: paths
186 CHARACTER(LEN=500) individualpath
188 INTEGER xscalarid, xvectorid, xmultiid
189 INTEGER nmultidatasets
199 call xf_get_scalar_datasets_info(a_xgroupid, npaths, nmaxpathlength, nstatus)
200 if (nstatus >= 0 .AND. npaths > 0)
then
201 allocate(paths(npaths*nmaxpathlength))
202 call xf_get_scalar_dataset_paths(a_xgroupid, npaths, nmaxpathlength, paths, &
205 if (nstatus < 0)
then
211 WRITE(a_fileunit,*)
'Number of Scalars ', npaths
214 do j=1, nmaxpathlength-1
215 individualpath(j:j) = paths((i-1)*nmaxpathlength+j)
217 WRITE(a_fileunit,*)
'Reading scalar: ', individualpath(1:nmaxpathlength-1)
218 call xf_open_group(a_xgroupid, individualpath(1:nmaxpathlength-1), &
220 if (nstatus < 0)
then
225 call tdi_read_scalar(xscalarid, a_fileunit, nstatus)
226 call xf_close_group(xscalarid, error)
227 if (nstatus < 0)
then
228 WRITE(*,*)
'Error reading scalar dataset.'
234 if (
allocated(paths))
deallocate(paths)
236 call xf_get_vector_datasets_info(a_xgroupid, npaths, nmaxpathlength, nstatus)
237 if (nstatus >= 0 .AND. npaths > 0)
then
238 allocate(paths(npaths*nmaxpathlength))
239 call xf_get_vector_dataset_paths(a_xgroupid, npaths, nmaxpathlength, paths, error)
241 if (nstatus < 0)
then
247 WRITE(a_fileunit,*)
'Number of Vectors ', npaths
249 do j=1, nmaxpathlength-1
250 individualpath(j:j) = paths((i-1)*nmaxpathlength+j)
252 WRITE(a_fileunit,*)
'Reading Vector: ', &
253 individualpath(1:nmaxpathlength-1)
254 call xf_open_group(a_xgroupid, individualpath(1:nmaxpathlength-1), &
256 if (nstatus < 0)
then
260 call tdi_read_vector(xvectorid, a_fileunit, nstatus)
261 call xf_close_group(xvectorid, error)
262 if (nstatus < 0)
then
263 WRITE(*,*)
'Error reading vector dataset.'
269 if (
allocated(paths))
deallocate(paths)
272 call xf_get_grp_pths_sz_mlt_dsets(a_xgroupid, nmultidatasets, &
273 nmaxpathlength, nstatus)
274 if (nstatus >= 0 .AND. nmultidatasets > 0)
then
275 allocate(paths(nmultidatasets*nmaxpathlength))
276 call xf_get_all_grp_paths_mlt_dsets(a_xgroupid, nmultidatasets, &
277 nmaxpathlength, paths, error)
278 if (nstatus < 0)
then
284 WRITE(a_fileunit,*)
'Number of Multidatasets ', nmultidatasets
285 do i=2, nmultidatasets
287 do j=1, nmaxpathlength-1
288 individualpath(j:j) = paths((i-1)*nmaxpathlength+j)
290 WRITE(a_fileunit,*)
'Reading multidataset: ', &
291 individualpath(1:nmaxpathlength-1)
292 call xf_open_group(a_xgroupid, individualpath(1:nmaxpathlength-1), &
294 if (nstatus < 0)
then
299 call td_read_datasets(xmultiid, a_fileunit, nstatus)
300 call xf_close_group(xmultiid, error)
301 if (nstatus < 0)
then
302 WRITE(*,*)
'Error reading multidatasets.'
308 if (
allocated(paths))
deallocate(paths)
320 SUBROUTINE td_read_activity_scalar_a_index(a_Filename, a_Index, error)
321 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
322 INTEGER,
INTENT(IN) :: a_index
323 INTEGER,
INTENT(OUT) :: error
325 INTEGER xfileid, xdsetsid, xscalaraid
326 INTEGER ntimesteps, i
327 INTEGER,
ALLOCATABLE :: bactive(:)
334 call xf_open_file(a_filename, .true., xfileid, status)
341 call xf_open_group(xfileid, datasets_location, xdsetsid, status)
342 if (status >= 0)
then
343 call xf_open_group(xdsetsid, scalar_a_location, xscalaraid, status)
351 CALL xf_get_dataset_num_times(xscalaraid, ntimesteps, status)
357 if (ntimesteps < 1)
then
363 allocate(bactive(ntimesteps))
364 call xf_read_active_vals_at_index(xscalaraid, a_index, 1, ntimesteps, &
368 WRITE(*,*)
'Reading activity for scalar A slice at index: ', a_index
370 WRITE(*,*) bactive(i),
' '
386 SUBROUTINE td_read_scalar_a_index (a_Filename, a_Index, error)
387 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
388 INTEGER,
INTENT(IN) :: a_index
389 INTEGER,
INTENT(OUT) :: error
391 INTEGER xfileid, xdsetsid, xscalaraid
392 INTEGER ntimesteps, i
393 REAL,
ALLOCATABLE :: fvalues(:)
400 call xf_open_file(a_filename, .true., xfileid, status)
407 call xf_open_group(xfileid, datasets_location, xdsetsid, status)
408 if (status >= 0)
then
409 call xf_open_group(xdsetsid, scalar_a_location, xscalaraid, status)
417 call xf_get_dataset_num_times(xscalaraid, ntimesteps, status)
423 if (ntimesteps < 1)
then
429 allocate (fvalues(ntimesteps))
430 call xf_read_scalar_values_at_index(xscalaraid, a_index, 1, ntimesteps, &
435 WRITE(*,*)
'Reading scalar A slice at index: ', a_index
437 WRITE(*,*) fvalues(i),
' '
458 SUBROUTINE td_write_scalar_a (a_Filename, a_Compression, error)
459 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
460 INTEGER,
INTENT(IN) :: a_compression
461 INTEGER,
INTENT(OUT) :: error
462 INTEGER xfileid, xdsetsid, xscalaraid, xcoordid
463 INTEGER nvalues, ntimes, nactive
464 REAL(DOUBLE) dtime, djulianreftime
465 INTEGER itimestep, iactive, ihpgnzone
467 INTEGER*1 bactivity(10)
477 do iactive = 1, nactive
478 bactivity(iactive) = 1
484 call xf_create_file(a_filename, .true., xfileid, error)
485 if (error .LT. 0)
then
487 call xf_close_file(xfileid, error)
492 call xf_create_generic_group(xfileid, datasets_location, xdsetsid, status)
494 call xf_close_file(xfileid, error)
500 call xf_create_scalar_dataset(xdsetsid, scalar_a_location,
'mg/L', &
501 ts_hours, a_compression, xscalaraid, status)
502 if (status .LT. 0)
then
504 call xf_close_group(xscalaraid, error)
505 call xf_close_group(xdsetsid, error)
506 call xf_close_file(xfileid, error)
513 djulianreftime = 2452822.0;
514 call xf_write_reftime(xscalaraid, djulianreftime, status)
516 call xf_close_group(xscalaraid, error)
517 call xf_close_group(xdsetsid, error)
518 call xf_close_file(xfileid, error)
522 do itimestep = 1, ntimes
524 dtime = itimestep * 0.5
528 fvalues(i) = fvalues(i-1)*2.5
532 call xf_write_scalar_timestep(xscalaraid, dtime, nvalues, fvalues, error)
533 if (error .GE. 0)
then
535 call xf_write_activity_timestep(xscalaraid, nactive, bactivity, error)
541 call xf_create_coordinate_group(xfileid, xcoordid, status)
543 call xf_close_group(xscalaraid, error)
544 call xf_close_group(xdsetsid, error)
545 call xf_close_file(xfileid, error)
553 call xf_set_horiz_datum(xcoordid, horiz_datum_geographic_hpgn, error)
554 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
555 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
556 call xf_set_vert_units(xcoordid, coord_units_meters, error)
559 call xf_set_hpgn_area(xcoordid, ihpgnzone, error)
561 call xf_close_group(xcoordid, error)
565 call xf_close_group(xscalaraid, error)
566 call xf_close_group(xdsetsid, error)
567 call xf_close_file(xfileid, error)
583 SUBROUTINE td_write_scalar_a_pieces (a_Filename, a_Compression, error)
584 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
585 INTEGER,
INTENT(IN) :: a_compression
586 INTEGER,
INTENT(OUT) :: error
587 INTEGER xfileid, xdsetsid, xscalaraid, xcoordid
588 INTEGER nvalues, ntimes, nactive
589 REAL(DOUBLE) dtime, djulianreftime
590 INTEGER itimestep, iactive, ihpgnzone
592 INTEGER*1 bactivity(10)
594 REAL minvalue, maxvalue
605 do iactive = 1, nactive
606 bactivity(iactive) = 1
612 call xf_create_file(a_filename, .true., xfileid, error)
613 if (error .LT. 0)
then
615 call xf_close_file(xfileid, error)
620 call xf_create_generic_group(xfileid, datasets_location, xdsetsid, status)
622 call xf_close_file(xfileid, error)
628 call xf_create_scalar_dataset(xdsetsid, scalar_a_location,
'mg/L', &
629 ts_hours, a_compression, xscalaraid, status)
630 if (status .LT. 0)
then
632 call xf_close_group(xscalaraid, error)
633 call xf_close_group(xdsetsid, error)
634 call xf_close_file(xfileid, error)
641 djulianreftime = 2452822.0;
642 call xf_write_reftime(xscalaraid, djulianreftime, status)
644 call xf_close_group(xscalaraid, error)
645 call xf_close_group(xdsetsid, error)
646 call xf_close_file(xfileid, error)
650 do itimestep = 1, ntimes
652 dtime = itimestep * 0.5
655 minvalue = fvalues(1)
656 maxvalue = fvalues(1)
658 fvalues(i) = fvalues(i-1)*2.5
659 minvalue = min(minvalue, fvalues(i))
660 maxvalue = max(maxvalue, fvalues(i))
664 call xf_initialize_scalar_timestep(xscalaraid, dtime, nvalues, minvalue, &
665 maxvalue, timestepid, error)
668 do i = 1, nvalues, +2
669 call xf_write_scalar_timestep_portion(xscalaraid, timestepid, 2, i, &
673 if (error .GE. 0)
then
675 call xf_initialize_activity_timestep(xscalaraid, nactive, activets, error)
677 do i = 1, nactive, +2
678 call xf_write_activity_timestep_portion(xscalaraid, activets, 2, &
679 i, bactivity(i), error)
687 call xf_create_coordinate_group(xfileid, xcoordid, status)
689 call xf_close_group(xscalaraid, error)
690 call xf_close_group(xdsetsid, error)
691 call xf_close_file(xfileid, error)
699 call xf_set_horiz_datum(xcoordid, horiz_datum_geographic_hpgn, error)
700 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
701 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
702 call xf_set_vert_units(xcoordid, coord_units_meters, error)
705 call xf_set_hpgn_area(xcoordid, ihpgnzone, error)
707 call xf_close_group(xcoordid, error)
711 call xf_close_group(xscalaraid, error)
712 call xf_close_group(xdsetsid, error)
713 call xf_close_file(xfileid, error)
729 SUBROUTINE td_write_scalar_a_pieces_alt_min_max (a_Filename, a_Compression, error)
730 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
731 INTEGER,
INTENT(IN) :: a_compression
732 INTEGER,
INTENT(OUT) :: error
733 INTEGER xfileid, xdsetsid, xscalaraid, xcoordid
734 INTEGER nvalues, ntimes, nactive
735 REAL(DOUBLE) dtime, djulianreftime
736 INTEGER itimestep, iactive, ihpgnzone
738 INTEGER*1 bactivity(10)
740 REAL minvalue, maxvalue
751 do iactive = 1, nactive
752 bactivity(iactive) = 1
758 call xf_create_file(a_filename, .true., xfileid, error)
759 if (error .LT. 0)
then
761 call xf_close_file(xfileid, error)
766 call xf_create_generic_group(xfileid, datasets_location, xdsetsid, status)
768 call xf_close_file(xfileid, error)
774 call xf_create_scalar_dataset(xdsetsid, scalar_a_location,
'mg/L', &
775 ts_hours, a_compression, xscalaraid, status)
776 if (status .LT. 0)
then
778 call xf_close_group(xscalaraid, error)
779 call xf_close_group(xdsetsid, error)
780 call xf_close_file(xfileid, error)
787 djulianreftime = 2452822.0;
788 call xf_write_reftime(xscalaraid, djulianreftime, status)
790 call xf_close_group(xscalaraid, error)
791 call xf_close_group(xdsetsid, error)
792 call xf_close_file(xfileid, error)
796 do itimestep = 1, ntimes
798 dtime = itimestep * 0.5
801 minvalue = fvalues(1)
802 maxvalue = fvalues(1)
804 fvalues(i) = fvalues(i-1)*2.5
805 minvalue = min(minvalue, fvalues(i))
806 maxvalue = max(maxvalue, fvalues(i))
810 call xf_initialize_scalar_timestep(xscalaraid, dtime, nvalues, minvalue, &
811 maxvalue, timestepid, error)
814 do i = 1, nvalues, +2
815 call xf_write_scalar_timestep_portion(xscalaraid, timestepid, 2, i, &
819 minvalue = 0.1111*timestepid
820 maxvalue = 1111*timestepid
821 call xf_set_dataset_timestep_min_max(xscalaraid, timestepid, minvalue, &
824 if (error .GE. 0)
then
826 call xf_initialize_activity_timestep(xscalaraid, nactive, activets, error)
828 do i = 1, nactive, +2
829 call xf_write_activity_timestep_portion(xscalaraid, activets, 2, &
830 i, bactivity(i), error)
838 call xf_create_coordinate_group(xfileid, xcoordid, status)
840 call xf_close_group(xscalaraid, error)
841 call xf_close_group(xdsetsid, error)
842 call xf_close_file(xfileid, error)
850 call xf_set_horiz_datum(xcoordid, horiz_datum_geographic_hpgn, error)
851 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
852 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
853 call xf_set_vert_units(xcoordid, coord_units_meters, error)
856 call xf_set_hpgn_area(xcoordid, ihpgnzone, error)
858 call xf_close_group(xcoordid, error)
862 call xf_close_group(xscalaraid, error)
863 call xf_close_group(xdsetsid, error)
864 call xf_close_file(xfileid, error)
881 SUBROUTINE td_write_scalar_b (a_Filename, a_Compression, a_Overwrite, error)
882 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
883 INTEGER,
INTENT(IN) :: a_compression
884 LOGICAL,
INTENT(IN) :: a_overwrite
885 INTEGER,
INTENT(OUT) :: error
886 INTEGER xfileid, xdsetsid, xscalarbid, xcoordid
887 INTEGER nvalues, ntimes, nactive
888 REAL(DOUBLE) dtime, djulianreftime
889 INTEGER itimestep, iactive
891 INTEGER*1 bactivity(10)
902 do iactive = 1, nactive
903 bactivity(iactive) = 1
907 if (a_overwrite)
then
909 call xf_open_file(a_filename, .false., xfileid, status)
915 call xf_open_group(xfileid, datasets_location, xdsetsid, status)
917 call xf_close_file(xfileid, error)
923 call xf_create_file(a_filename, .true., xfileid, error)
924 if (error .LT. 0)
then
926 call xf_close_file(xfileid, error)
931 call xf_create_generic_group(xfileid, datasets_location, xdsetsid, status)
933 call xf_close_file(xfileid, error)
940 call xf_create_scalar_dataset(xdsetsid, scalar_b_location,
'mg/L', &
941 ts_hours, a_compression, xscalarbid, status)
944 call xf_close_group(xscalarbid, error)
945 call xf_close_group(xdsetsid, error)
946 call xf_close_file(xfileid, error)
953 djulianreftime = 2452822.0;
954 call xf_write_reftime(xscalarbid, djulianreftime, status)
956 call xf_close_group(xscalarbid, error)
957 call xf_close_group(xdsetsid, error)
958 call xf_close_file(xfileid, error)
961 if (.NOT. a_overwrite)
then
963 do itimestep = 1, ntimes
965 dtime = itimestep * 0.5
969 fvalues(i) = fvalues(i-1)*2.5
973 call xf_write_scalar_timestep(xscalarbid, dtime, nvalues, fvalues, error)
974 if (error .GE. 0)
then
976 call xf_write_activity_timestep(xscalarbid, nactive, bactivity, error)
979 call xf_close_group(xscalarbid, error)
980 call xf_close_group(xdsetsid, error)
981 call xf_close_file(xfileid, error)
986 do itimestep = 1, ntimes
988 dtime = itimestep * 1.5
992 fvalues(i) = fvalues(i-1)*1.5
996 call xf_write_scalar_timestep(xscalarbid, dtime, nvalues, fvalues, error)
997 if (error .GE. 0)
then
999 call xf_write_activity_timestep(xscalarbid, nactive, bactivity, error)
1002 call xf_close_group(xscalarbid, error)
1003 call xf_close_group(xdsetsid, error)
1004 call xf_close_file(xfileid, error)
1009 if (.NOT. a_overwrite)
then
1012 call xf_create_coordinate_group(xfileid, xcoordid, status)
1013 if (status < 0)
then
1014 call xf_close_group(xscalarbid, error)
1015 call xf_close_group(xdsetsid, error)
1016 call xf_close_file(xfileid, error)
1022 call xf_set_horiz_datum(xcoordid, horiz_datum_utm, error)
1023 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
1025 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
1026 call xf_set_vert_units(xcoordid, coord_units_meters, error)
1029 call xf_set_utm_zone(xcoordid, utm_zone_max, error)
1031 call xf_close_group(xcoordid, error)
1036 call xf_close_group(xscalarbid, error)
1037 call xf_close_group(xdsetsid, error)
1038 call xf_close_file(xfileid, error)
1049 SUBROUTINE td_write_coords_to_multi (a_xFileId, error)
1050 INTEGER,
INTENT(IN) :: a_xfileid
1051 INTEGER,
INTENT(OUT) :: error
1057 call xf_create_coordinate_group(a_xfileid, xcoordid, status)
1058 if (status < 0)
then
1064 call xf_set_horiz_datum(xcoordid, horiz_datum_utm, error)
1065 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
1067 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
1068 call xf_set_vert_units(xcoordid, coord_units_meters, error)
1071 call xf_set_utm_zone(xcoordid, utm_zone_max, error)
1073 call xf_close_group(xcoordid, error)
1089 SUBROUTINE td_write_scalar_a_to_multi (a_GroupID, status)
1093 INTEGER xfileid, xdsetsid, xscalaraid
1095 INTEGER nvalues, ntimes, nactive
1096 REAL(DOUBLE) dtime, djulianreftime
1097 INTEGER itimestep, iactive
1099 INTEGER*1 bactivity(10)
1109 do iactive = 1, nactive
1110 bactivity(iactive) = 1
1115 call xf_create_scalar_dataset(a_groupid, scalar_a_location,
'mg/L', &
1116 ts_hours, none, xscalaraid, status)
1117 if (status .LT. 0)
then
1119 call xf_close_group(xscalaraid, status)
1120 call xf_close_group(xdsetsid, status)
1121 call xf_close_file(xfileid, status)
1127 djulianreftime = 2452822.0;
1128 call xf_write_reftime(xscalaraid, djulianreftime, status)
1129 if (status < 0)
then
1130 call xf_close_group(xscalaraid, status)
1131 call xf_close_group(xdsetsid, status)
1132 call xf_close_file(xfileid, status)
1136 do itimestep = 1, ntimes
1138 dtime = itimestep * 0.5
1142 fvalues(i) = fvalues(i-1)*2.5
1146 call xf_write_scalar_timestep(xscalaraid, dtime, nvalues, fvalues, status)
1147 if (status .GE. 0)
then
1149 call xf_write_activity_timestep(xscalaraid, nactive, bactivity, status)
1154 call xf_close_group(xscalaraid, status)
1166 SUBROUTINE td_read_vector2d_a_index (a_Filename, a_Index, error)
1167 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
1168 INTEGER,
INTENT(IN) :: a_index
1169 INTEGER,
INTENT(OUT) :: error
1171 INTEGER xfileid, xdsetsid, xvector2da
1172 INTEGER ntimesteps, i
1173 REAL,
ALLOCATABLE :: fvalues(:)
1180 call xf_open_file(a_filename, .true., xfileid, status)
1181 if (status < 0)
then
1187 call xf_open_group(xfileid, datasets_location, xdsetsid, status)
1188 if (status >= 0)
then
1189 call xf_open_group(xdsetsid, vector2d_a_location, xvector2da, status)
1191 if (status < 0)
then
1197 call xf_get_dataset_num_times(xvector2da, ntimesteps, status)
1198 if (status < 0)
then
1203 if (ntimesteps < 1)
then
1209 allocate(fvalues(ntimesteps*2))
1210 call xf_read_vector_values_at_index(xvector2da, a_index, 1, ntimesteps, 2, &
1215 WRITE(*,*)
'Reading vector 2D A slice at index: ', a_index
1217 WRITE(*,*) fvalues(i*2-1),
' ', fvalues(i*2)
1239 SUBROUTINE td_write_vector2d_a (a_Filename, a_Compression, error)
1240 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
1241 INTEGER,
INTENT(IN) :: a_compression
1242 INTEGER,
INTENT(OUT) :: error
1243 INTEGER xfileid, xdsetsid, xvector2d_a, xcoordid
1244 INTEGER nvalues, ntimes, ncomponents, nactive
1246 INTEGER itimestep, iactive
1247 REAL,
DIMENSION(2, 100) :: fvalues
1248 INTEGER*1 bactivity(100)
1249 INTEGER i, j, status
1261 do iactive = 2, nactive
1262 if (mod(iactive-1, 3) == 0)
then
1263 bactivity(iactive) = 0
1265 bactivity(iactive) = 1
1270 call xf_create_file(a_filename, .true., xfileid, error)
1271 if (error .LT. 0)
then
1273 call xf_close_file(xfileid, error)
1278 call xf_create_generic_group(xfileid, datasets_location, xdsetsid, status)
1279 if (status < 0)
then
1280 call xf_close_file(xfileid, error)
1286 call xf_create_vector_dataset(xdsetsid, vector2d_a_location,
'ft/s', &
1287 ts_seconds, a_compression, xvector2d_a, status)
1288 if (status .LT. 0)
then
1290 call xf_close_group(xvector2d_a, error)
1291 call xf_close_group(xdsetsid, error)
1292 call xf_close_file(xfileid, error)
1298 do itimestep = 1, ntimes
1300 dtime = itimestep * 0.5
1303 do j = 1, ncomponents
1304 fvalues(j,i) = ((i-1)*ncomponents + j)*dtime
1309 call xf_write_vector_timestep(xvector2d_a, dtime, nvalues, ncomponents, &
1311 if (error .GE. 0)
then
1313 call xf_write_activity_timestep(xvector2d_a, nactive, bactivity, error)
1319 call xf_create_coordinate_group(xfileid, xcoordid, status)
1320 if (status < 0)
then
1321 call xf_close_group(xvector2d_a, error)
1322 call xf_close_group(xdsetsid, error)
1323 call xf_close_file(xfileid, error)
1331 call xf_set_horiz_datum(xcoordid, horiz_datum_geographic_hpgn, error)
1332 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
1333 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
1334 call xf_set_vert_units(xcoordid, coord_units_meters, error)
1337 call xf_set_hpgn_area(xcoordid, ihpgnzone, error)
1339 call xf_close_group(xcoordid, error)
1343 call xf_close_group(xvector2d_a, error)
1344 call xf_close_group(xdsetsid, error)
1345 call xf_close_file(xfileid, error)
1361 SUBROUTINE td_write_vector2d_a_pieces (a_Filename, a_Compression, error)
1362 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
1363 INTEGER,
INTENT(IN) :: a_compression
1364 INTEGER,
INTENT(OUT) :: error
1365 INTEGER xfileid, xdsetsid, xvector2d_a, xcoordid
1366 INTEGER nvalues, ntimes, ncomponents, nactive
1368 INTEGER itimestep, iactive
1369 REAL*4,
DIMENSION(2, 100) :: fvalues
1370 INTEGER*1 bactivity(100)
1371 INTEGER i, j, status
1373 INTEGER nvaluestowrite, ncomponentstowrite, startcomponent
1374 REAL*4 minvalue, maxvalue
1387 do iactive = 2, nactive
1388 if (mod(iactive-1, 3) == 0)
then
1389 bactivity(iactive) = 0
1391 bactivity(iactive) = 1
1396 call xf_create_file(a_filename, .true., xfileid, error)
1397 if (error .LT. 0)
then
1399 call xf_close_file(xfileid, error)
1404 call xf_create_generic_group(xfileid, datasets_location, xdsetsid, status)
1405 if (status < 0)
then
1406 call xf_close_file(xfileid, error)
1412 call xf_create_vector_dataset(xdsetsid, vector2d_a_location,
'ft/s', &
1413 ts_seconds, a_compression, xvector2d_a, status)
1414 if (status .LT. 0)
then
1416 call xf_close_group(xvector2d_a, error)
1417 call xf_close_group(xdsetsid, error)
1418 call xf_close_file(xfileid, error)
1424 do itimestep = 1, ntimes
1426 dtime = itimestep * 0.5
1429 do j = 1, ncomponents
1430 fvalues(j,i) = ((i-1)*ncomponents + j)*dtime
1438 do j = 1, ncomponents
1439 mag = mag + fvalues(j, i)**2
1443 minvalue = min(minvalue, mag)
1444 maxvalue = max(maxvalue, mag)
1448 call xf_initialize_vector_timestep(xvector2d_a, dtime, nvalues, ncomponents, &
1449 minvalue, maxvalue, timeid, error)
1452 ncomponentstowrite = 2
1455 do i = 1, nvalues, +2
1456 call xf_write_vector_timestep_portion(xvector2d_a, timeid, nvaluestowrite, &
1457 ncomponentstowrite, i, startcomponent, fvalues(1, i), error)
1460 if (error .GE. 0)
then
1462 call xf_write_activity_timestep(xvector2d_a, nactive, bactivity, error)
1468 call xf_create_coordinate_group(xfileid, xcoordid, status)
1469 if (status < 0)
then
1470 call xf_close_group(xvector2d_a, error)
1471 call xf_close_group(xdsetsid, error)
1472 call xf_close_file(xfileid, error)
1480 call xf_set_horiz_datum(xcoordid, horiz_datum_geographic_hpgn, error)
1481 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
1482 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
1483 call xf_set_vert_units(xcoordid, coord_units_meters, error)
1486 call xf_set_hpgn_area(xcoordid, ihpgnzone, error)
1488 call xf_close_group(xcoordid, error)
1492 call xf_close_group(xvector2d_a, error)
1493 call xf_close_group(xdsetsid, error)
1494 call xf_close_file(xfileid, error)
1510 SUBROUTINE td_write_vector2d_b (a_Filename, a_Compression, a_Overwrite, error)
1511 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
1512 INTEGER,
INTENT(IN) :: a_compression
1513 LOGICAL,
INTENT(IN) :: a_overwrite
1514 INTEGER,
INTENT(OUT) :: error
1515 INTEGER xfileid, xdsetsid, xvector2d_b, xcoordid
1516 INTEGER nvalues, ntimes, ncomponents, nactive
1518 INTEGER itimestep, iactive
1519 REAL,
DIMENSION(2, 100) :: fvalues
1520 INTEGER*1 bactivity(100)
1521 INTEGER i, j, status
1532 do iactive = 2, nactive
1533 if (mod(iactive-1, 3) == 0)
then
1534 bactivity(iactive) = 0
1536 bactivity(iactive) = 1
1540 if (a_overwrite)
then
1542 call xf_open_file(a_filename, .false., xfileid, status)
1543 if (status < 0)
then
1548 call xf_open_group(xfileid, datasets_location, xdsetsid, status)
1549 if (status < 0)
then
1550 call xf_close_file(xfileid, error)
1556 call xf_create_file(a_filename, .true., xfileid, error)
1557 if (error .LT. 0)
then
1559 call xf_close_file(xfileid, error)
1564 call xf_create_generic_group(xfileid, datasets_location, xdsetsid, status)
1565 if (status < 0)
then
1566 call xf_close_file(xfileid, error)
1573 call xf_create_vector_dataset(xdsetsid, vector2d_b_location,
'ft/s', &
1574 ts_seconds, a_compression, xvector2d_b, status)
1575 if (status .LT. 0)
then
1577 call xf_close_group(xvector2d_b, error)
1578 call xf_close_group(xdsetsid, error)
1579 call xf_close_file(xfileid, error)
1584 if (.NOT. a_overwrite)
then
1586 do itimestep = 1, ntimes
1588 dtime = itimestep * 0.5
1590 do j = 1, ncomponents
1591 fvalues(j,i) = ((i-1)*ncomponents + j)*dtime
1595 call xf_write_vector_timestep(xvector2d_b, dtime, nvalues, ncomponents, &
1597 if (error .GE. 0)
then
1599 call xf_write_activity_timestep(xvector2d_b, nactive, bactivity, error)
1602 call xf_close_group(xvector2d_b, error)
1603 call xf_close_group(xdsetsid, error)
1604 call xf_close_file(xfileid, error)
1609 do itimestep = 1, ntimes
1611 dtime = itimestep * 1.5
1613 do j = 1, ncomponents
1614 fvalues(j,i) = ((i-1)*ncomponents + j)*dtime
1618 call xf_write_vector_timestep(xvector2d_b, dtime, nvalues, ncomponents, &
1620 if (error .GE. 0)
then
1622 call xf_write_activity_timestep(xvector2d_b, nactive, bactivity, error)
1625 call xf_close_group(xvector2d_b, error)
1626 call xf_close_group(xdsetsid, error)
1627 call xf_close_file(xfileid, error)
1632 if (.NOT. a_overwrite)
then
1635 call xf_create_coordinate_group(xfileid, xcoordid, status)
1636 if (status < 0)
then
1637 call xf_close_group(xvector2d_b, error)
1638 call xf_close_group(xdsetsid, error)
1639 call xf_close_file(xfileid, error)
1645 call xf_set_horiz_datum(xcoordid, horiz_datum_utm, error)
1646 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
1647 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
1648 call xf_set_vert_units(xcoordid, coord_units_meters, error)
1651 call xf_set_utm_zone(xcoordid, utm_zone_max, error)
1653 call xf_close_group(xcoordid, error)
1658 call xf_close_group(xvector2d_b, error)
1659 call xf_close_group(xdsetsid, error)
1660 call xf_close_file(xfileid, error)
1676 SUBROUTINE td_write_vector2d_a_to_multi (a_FileID, a_GroupID, status)
1678 INTEGER a_fileid, a_groupid
1679 INTEGER nvalues, ntimes, ncomponents, nactive
1681 INTEGER itimestep, iactive
1682 REAL,
DIMENSION(2, 100) :: fvalues
1683 INTEGER*1 bactivity(100)
1684 INTEGER i, j, status
1695 do iactive = 2, nactive
1696 if (mod(iactive-1, 3) == 0)
then
1697 bactivity(iactive) = 0
1699 bactivity(iactive) = 1
1704 call xf_create_vector_dataset(a_groupid, vector2d_a_location,
'ft/s', &
1705 ts_seconds, none, xvector2d_a, status)
1706 if (status .LT. 0)
then
1708 call xf_close_group(xvector2d_a, status)
1709 call xf_close_group(a_groupid, status)
1710 call xf_close_file(a_fileid, status)
1715 do itimestep = 1, ntimes
1717 dtime = itimestep * 0.5
1720 do j = 1, ncomponents
1721 fvalues(j,i) = ((i-1)*ncomponents + j)*dtime
1726 call xf_write_vector_timestep(xvector2d_a, dtime, nvalues, ncomponents, &
1728 if (status .GE. 0)
then
1730 call xf_write_activity_timestep(xvector2d_a, nactive, bactivity, status)
1735 call xf_close_group(xvector2d_a, status)
1739 integer function strlen(st)
1743 do while (st(i:i) .eq.
' ' .or. ichar(st(i:i)) .eq. 0)
1755 SUBROUTINE tdi_read_scalar (a_xScalarId, FileUnit, error)
1756 INTEGER,
INTENT(IN) :: a_xscalarid
1757 INTEGER,
INTENT(IN) :: fileunit
1758 INTEGER,
INTENT(OUT) :: error
1759 INTEGER ntimes, nvalues, nactive
1760 LOGICAL*2 busereftime
1762 CHARACTER(LEN=100) timeunits, units
1763 REAL(DOUBLE),
ALLOCATABLE :: times(:)
1764 REAL,
ALLOCATABLE :: values(:), minimums(:), maximums(:)
1765 INTEGER,
ALLOCATABLE :: active(:)
1766 REAL(DOUBLE) reftime
1772 call xf_get_dataset_time_units(a_xscalarid, timeunits, error)
1773 if (error < 0)
return
1775 WRITE(fileunit,*)
'Time units: ', timeunits(1:strlen(timeunits))
1778 call xf_use_reftime(a_xscalarid, busereftime, error)
1779 if (error < 0 )
then
1782 if (busereftime)
then
1783 call xf_read_reftime(a_xscalarid, reftime, error)
1784 if (error < 0 )
then
1792 call xf_get_dataset_units(a_xscalarid, units, error)
1793 if (error < 0)
return
1794 WRITE(fileunit,*)
'Units: ', units(1:strlen(units))
1797 call xf_get_dataset_numvals(a_xscalarid, nvalues, error)
1798 if (error .GE. 0)
then
1799 call xf_get_dataset_numactive(a_xscalarid, nactive, error)
1801 if (error .LT. 0)
return
1803 if (nvalues <= 0)
then
1804 WRITE(fileunit, *)
'No data to read in.'
1810 call xf_get_dataset_num_times(a_xscalarid, ntimes, error)
1816 allocate(times(ntimes))
1818 call xf_get_dataset_times(a_xscalarid, ntimes, times, error)
1819 if (error < 0)
return
1822 allocate(minimums(ntimes))
1823 allocate(maximums(ntimes))
1825 call xf_get_dataset_mins(a_xscalarid, ntimes, minimums, error)
1826 if (error >= 0)
then
1827 call xf_get_dataset_maxs(a_xscalarid, ntimes, maximums, error)
1831 deallocate(minimums)
1832 deallocate(maximums)
1836 allocate(values(nvalues))
1837 if (nactive .GT. 0)
then
1838 allocate(active(nactive))
1841 WRITE(fileunit,*)
'Number Timesteps: ', ntimes
1842 WRITE(fileunit,*)
'Number Values: ', nvalues
1843 WRITE(fileunit,*)
'Number Active: ', nactive
1844 WRITE(fileunit,*)
''
1848 do itime = 1, ntimes
1849 call xf_read_scalar_values_timestep(a_xscalarid, itime, nvalues, values, error)
1850 if (error >= 0 .AND. nactive > 0)
then
1851 call xf_read_activity_timestep(a_xscalarid, itime, nactive, active, error)
1856 WRITE(fileunit,*)
'Timestep at ', times(itime)
1857 WRITE(fileunit,*)
'Min: ', minimums(itime)
1858 WRITE(fileunit,*)
'Max: ', maximums(itime)
1860 WRITE(fileunit,*)
'Values:'
1861 WRITE(fileunit,*) values(1:nvalues)
1862 WRITE(fileunit,*)
''
1864 WRITE(fileunit,*)
'Activity:'
1865 WRITE(fileunit,*) active(1:nactive)
1866 WRITE(fileunit,*)
''
1869 if (
allocated(times))
then
1873 if (
allocated(minimums))
then
1874 deallocate(minimums)
1877 if (
allocated(maximums))
then
1878 deallocate(maximums)
1881 if (
allocated(values))
then
1885 if (
allocated(active))
then
1899 SUBROUTINE tdi_read_vector (a_xVectorId, FileUnit, error)
1900 INTEGER,
INTENT(IN) :: a_xvectorid
1901 INTEGER,
INTENT(IN) :: fileunit
1902 INTEGER,
INTENT(OUT) :: error
1903 INTEGER ntimes, nvalues, nactive, ncomponents
1905 LOGICAL*2 busereftime
1906 CHARACTER(LEN=100) timeunits
1907 REAL(DOUBLE),
ALLOCATABLE :: times(:)
1908 REAL,
ALLOCATABLE,
DIMENSION (:, :) :: values
1909 REAL,
ALLOCATABLE :: minimums(:), maximums(:)
1910 INTEGER,
ALLOCATABLE :: active(:)
1911 REAL(DOUBLE) reftime
1919 call xf_get_dataset_time_units(a_xvectorid, timeunits, error)
1920 if (error < 0)
return
1922 WRITE(fileunit,*)
'Time units: ', timeunits(1:len_trim(timeunits))
1925 call xf_use_reftime(a_xvectorid, busereftime, error)
1929 if (busereftime)
then
1930 call xf_read_reftime(a_xvectorid, reftime, error)
1938 call xf_get_dataset_numvals(a_xvectorid, nvalues, error)
1939 if (error .GE. 0)
then
1940 call xf_get_dataset_numcomponents(a_xvectorid, ncomponents, error)
1941 if (error .GE. 0)
then
1942 call xf_get_dataset_numactive(a_xvectorid, nactive, error)
1945 if (error .LT. 0)
return
1947 if (nvalues <= 0)
then
1948 WRITE(fileunit, *)
'No data to read in.'
1954 call xf_get_dataset_num_times(a_xvectorid, ntimes, error)
1960 allocate(times(ntimes))
1962 call xf_get_dataset_times(a_xvectorid, ntimes, times, error)
1963 if (error < 0)
return
1966 allocate(minimums(ntimes))
1967 allocate(maximums(ntimes))
1969 call xf_get_dataset_mins(a_xvectorid, ntimes, minimums, error)
1970 if (error >= 0)
then
1971 call xf_get_dataset_maxs(a_xvectorid, ntimes, maximums, error)
1975 deallocate(minimums)
1976 deallocate(maximums)
1980 allocate(values(ncomponents, nvalues))
1981 if (nactive .GT. 0)
then
1982 allocate(active(nactive))
1985 WRITE(fileunit,*)
'Number Timesteps: ', ntimes
1986 WRITE(fileunit,*)
'Number Values: ', nvalues
1987 WRITE(fileunit,*)
'Number Components: ', ncomponents
1988 WRITE(fileunit,*)
'Number Active: ', nactive
1992 do itime = 1, ntimes
1993 call xf_read_vector_values_timestep(a_xvectorid, itime, nvalues, &
1994 ncomponents, values, error)
1995 if (error >= 0 .AND. nactive > 0)
then
1996 call xf_read_activity_timestep(a_xvectorid, itime, nactive, active, error)
2001 WRITE(fileunit,*)
''
2002 WRITE(fileunit,*)
'Timestep at ', times(itime)
2003 WRITE(fileunit,*)
'Min: ', minimums(itime)
2004 WRITE(fileunit,*)
'Max: ', maximums(itime)
2006 WRITE(fileunit,*)
'Values:'
2008 WRITE(fileunit,*) values(1:ncomponents,i:i)
2010 WRITE(fileunit,*)
''
2012 WRITE(fileunit,*)
'Activity:'
2013 WRITE(fileunit,*) active(1:nactive)
2014 WRITE(fileunit,*)
''
2015 WRITE(fileunit,*)
''
2019 if (
allocated(times))
then
2023 if (
allocated(minimums))
then
2024 deallocate(minimums)
2027 if (
allocated(maximums))
then
2028 deallocate(maximums)
2031 if (
allocated(values))
then
2035 if (
allocated(active))
then
2043 END MODULE testdatasets
7 CHARACTER(LEN=*),
PARAMETER :: grid_cart2d_group_name =
'Grid Cart2D Group'
8 CHARACTER(LEN=*),
PARAMETER :: grid_curv2d_group_name =
'Grid Curv2D Group'
9 CHARACTER(LEN=*),
PARAMETER :: grid_cart3d_group_name =
'Grid Cart3D Group'
19 SUBROUTINE tg_read_grid(a_Id, a_Outfile, error)
20 INTEGER,
INTENT(IN) :: a_id
21 INTEGER,
INTENT(IN) :: a_outfile
22 INTEGER,
INTENT(OUT) :: error
23 INTEGER ngridtype, nextrudetype, ndims, ncellsi, ncellsj
24 INTEGER ncellsk, nlayers, norientation, nvalsi, nvalsj
25 INTEGER nvalsk, nextrudevals, ncomporigin, nudir
26 CHARACTER(265) strgridtype, strextrudetype
28 REAL(DOUBLE) dorigin(3), dbearing, ddip, droll
29 REAL(DOUBLE),
ALLOCATABLE :: dextrudevals(:), dcoordi(:), dcoordj(:)
30 REAL(DOUBLE),
ALLOCATABLE :: dcoordk(:)
55 call xf_get_grid_type(a_id, ngridtype, error)
59 SELECT CASE (ngridtype)
60 CASE (grid_type_cartesian)
61 strgridtype =
'Cartesian'
62 CASE (grid_type_curvilinear)
63 strgridtype =
'Curvilinear'
64 CASE (grid_type_cartesian_extruded)
65 strgridtype =
'Cartesian extruded'
66 CASE (grid_type_curvilinear_extruded)
67 strgridtype =
'Curvilinear extruded'
69 WRITE(*,*)
'Invalid grid type'
72 WRITE(a_outfile,*)
'The grid type is: ', strgridtype(1:len_trim(strgridtype))
75 call xf_get_number_of_dimensions(a_id, ndims, error)
76 if (error .LT. 0)
then
80 WRITE(a_outfile,*)
'The grid is two-dimensional'
81 elseif (ndims == 3)
then
82 WRITE(a_outfile,*)
'The grid is three-dimensional'
84 WRITE(*,*)
'The grid dimensions are invalid'
89 if (ngridtype .EQ. grid_type_cartesian_extruded .OR. &
90 ngridtype .EQ. grid_type_curvilinear_extruded)
then
91 call xf_get_extrusion_type(a_id, nextrudetype, error)
95 SELECT CASE (nextrudetype)
97 strextrudetype =
'Sigma stretch'
98 case (extrude_cartesian)
99 strextrudetype =
'Cartesian'
100 case (extrude_curv_at_corners)
101 strextrudetype =
'Curvilinear at Corners'
102 case (extrude_curv_at_cells)
103 strextrudetype =
'Curvilinear at Cells'
105 WRITE(a_outfile,*)
'The grid is extruding using: ', &
106 strextrudetype(1:len_trim(strextrudetype))
110 call xf_origin_defined(a_id, bdefined, error)
115 call xf_get_origin(a_id, dorigin(1), dorigin(2), dorigin(3), error)
119 WRITE(a_outfile,*)
'The grid origin is ', dorigin(1),
' ',&
120 dorigin(2),
' ', dorigin(3)
124 call xf_get_orientation(a_id, norientation, error)
128 if (norientation == orientation_right_hand)
then
129 WRITE(a_outfile,*)
'The grid has a right hand orientation'
130 elseif (norientation == orientation_left_hand)
then
131 WRITE(a_outfile,*)
'The grid has a left hand orientation'
133 WRITE(*,*)
'Invalid grid orientation';
139 call xf_bearing_defined(a_id, bdefined, error)
144 call xf_get_bearing(a_id, dbearing, error)
148 WRITE(a_outfile,*)
'The grid bearing is ', dbearing
152 call xf_dip_defined(a_id, bdefined, error)
157 call xf_get_dip(a_id, ddip, error)
161 WRITE(a_outfile,*)
'The grid Dip is ', ddip
166 call xf_roll_defined(a_id, bdefined, error)
171 call xf_get_roll(a_id, droll, error)
175 WRITE(a_outfile,*)
'The grid Roll is ', droll
180 call xf_computational_origin_defined(a_id, bdefined, error)
185 call xf_get_computational_origin(a_id, ncomporigin, error)
189 WRITE(a_outfile,*)
'The grid Computational Origin is ', ncomporigin
191 WRITE(a_outfile,*)
'The grid Computational Origin is not defined';
196 call xf_get_u_direction_defined(a_id, bdefined, error)
201 call xf_get_u_direction(a_id, nudir, error)
205 WRITE(a_outfile,*)
'The grid U Direction is ', nudir
207 WRITE(a_outfile,*)
'The grid U Direction is not defined'
211 call xf_get_number_cells_in_i(a_id, ncellsi, error)
213 call xf_get_number_cells_in_j(a_id, ncellsj, error)
214 if ((error >= 0) .AND. (ndims == 3))
then
215 call xf_get_number_cells_in_k(a_id, ncellsk, error)
221 WRITE(a_outfile,*)
'Number of cells in I ', ncellsi
222 WRITE(a_outfile,*)
'Number of cells in J ', ncellsj
224 WRITE(a_outfile,*)
'Number of cells in K ', ncellsk
228 if (ngridtype == grid_type_cartesian .OR. &
229 ngridtype == grid_type_cartesian_extruded)
then
235 elseif (ngridtype == grid_type_curvilinear .OR. &
236 ngridtype == grid_type_curvilinear_extruded)
then
239 nvalsk = (ncellsi + 1) * (ncellsj + 1) * (ncellsk + 1)
244 nvalsj = (ncellsi + 1) * (ncellsj + 1)
248 WRITE(*,*)
'Invalid grid type'
253 ALLOCATE(dcoordi(nvalsi))
254 ALLOCATE(dcoordj(nvalsj))
256 ALLOCATE(dcoordk(nvalsk))
259 call xf_get_grid_coords_i(a_id, nvalsi, dcoordi, error)
261 call xf_get_grid_coords_j(a_id, nvalsj, dcoordj, error)
262 if ((error >= 0) .AND. (ndims == 3))
then
263 call xf_get_grid_coords_k(a_id, nvalsk, dcoordk, error)
267 WRITE(*,*)
'Error reading coordinates'
272 WRITE(a_outfile,*)
'The Coordinates in direction I:'
274 if (mod(i,5) == 0)
then
275 WRITE(a_outfile,*)
''
277 WRITE(a_outfile,*) dcoordi(i)
279 WRITE(a_outfile,*)
''
281 WRITE(a_outfile,*)
'The Coordinates in direction J:'
283 if (mod(i,5) == 0)
then
284 WRITE(a_outfile,*)
''
286 WRITE(a_outfile,*) dcoordj(i)
288 WRITE(a_outfile,*)
''
291 WRITE(a_outfile,*)
'The Coordinates in direction K:'
293 if (mod(i,5) == 0)
then
294 WRITE(a_outfile,*)
''
296 WRITE(a_outfile,*) dcoordk(i)
299 WRITE(a_outfile,*)
''
301 if (
ALLOCATED(dcoordi))
DEALLOCATE(dcoordi)
302 if (
ALLOCATED(dcoordj))
DEALLOCATE(dcoordj)
303 if (
ALLOCATED(dcoordk))
DEALLOCATE(dcoordk)
306 if (ngridtype .EQ. grid_type_cartesian_extruded .OR. &
307 ngridtype .EQ. grid_type_curvilinear_extruded)
then
308 call xf_get_extrude_num_layers(a_id, nlayers, error)
313 SELECT CASE(nextrudetype)
315 nextrudevals = nlayers
316 case (extrude_curv_at_corners)
317 nextrudevals = (ncellsi + 1) * (ncellsj + 1) * nlayers
318 case (extrude_curv_at_cells)
319 nextrudevals = ncellsi * ncellsj * nlayers
322 ALLOCATE(dextrudevals(nextrudevals))
324 call xf_get_extrude_values(a_id, nextrudevals, dextrudevals, error)
329 WRITE(*,*)
'The extrude values are:'
330 do i = 1, nextrudevals
331 if (mod(i,5) == 0)
then
332 WRITE(a_outfile,*)
''
334 WRITE(a_outfile,*) dextrudevals(i)
336 if (
ALLOCATED(dextrudevals))
DEALLOCATE(dextrudevals)
341 END SUBROUTINE tg_read_grid
350 SUBROUTINE tg_write_test_grid_cart_2d(Filename, error)
351 CHARACTER(LEN=*),
INTENT(IN) :: filename
352 INTEGER,
INTENT(OUT) :: error
354 INTEGER ncellsi, ncellsj
356 INTEGER ncomporigin, nudir
357 REAL(DOUBLE) doriginx, doriginy, doriginz
359 REAL(DOUBLE) dbearing
360 REAL(DOUBLE) planesi(5), planesj(5)
361 INTEGER i, j, ispczone
362 INTEGER xfileid, xgridid, xcoordid
364 INTEGER tmpout1, tmpout2
369 ngridtype = grid_type_cartesian
375 norientation = orientation_right_hand
389 call xf_create_file(filename, .true., xfileid, status)
396 call xf_create_group_for_grid(xfileid, grid_cart2d_group_name, xgridid, status)
398 call xf_close_file(xfileid, error)
404 call xf_set_grid_type(xgridid, ngridtype, tmpout1)
405 call xf_set_number_of_dimensions(xgridid, ndimensions, tmpout2)
407 if ((tmpout1 < 0) .OR. (tmpout2 < 0))
then
408 call xf_close_group(xgridid, error)
409 call xf_close_file(xfileid, error)
415 call xf_set_origin(xgridid, doriginx, doriginy, doriginz, tmpout1)
416 call xf_set_orientation(xgridid, norientation, tmpout2)
418 if ((tmpout1 < 0) .OR. (tmpout2 .LT. 0))
then
419 call xf_close_group(xgridid, error)
420 call xf_close_file(xfileid, error)
426 call xf_set_bearing(xgridid, dbearing, tmpout1)
427 if (tmpout1 < 0)
then
428 call xf_close_group(xgridid, error)
429 call xf_close_file(xfileid, error)
435 call xf_set_computational_origin(xgridid, ncomporigin, tmpout1)
436 if (tmpout1 < 0)
then
437 call xf_close_group(xgridid, error)
438 call xf_close_file(xfileid, error)
444 call xf_set_u_direction(xgridid, nudir, tmpout1)
445 if (tmpout1 < 0)
then
446 call xf_close_group(xgridid, error)
447 call xf_close_file(xfileid, error)
454 call xf_set_number_cells_in_i(xgridid, ncellsi, tmpout1)
455 call xf_set_number_cells_in_j(xgridid, ncellsj, tmpout2)
456 if ((tmpout1 < 0) .OR. (tmpout2 < 0))
then
457 call xf_close_group(xgridid, error)
458 call xf_close_file(xfileid, error)
464 call xf_set_grid_coords_i(xgridid, ncellsi, planesi, tmpout1)
465 call xf_set_grid_coords_j(xgridid, ncellsj, planesj, tmpout2)
466 if ((tmpout1 < 0) .OR. (tmpout2 < 0))
then
467 call xf_close_group(xgridid, error)
468 call xf_close_file(xfileid, error)
475 call xf_create_coordinate_group(xfileid, xcoordid, status)
477 call xf_close_group(xgridid, error)
478 call xf_close_file(xfileid, error)
485 call xf_set_horiz_datum(xcoordid, horiz_datum_state_plane_nad27, error)
486 call xf_set_horiz_units(xcoordid, coord_units_us_feet, error)
488 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
489 call xf_set_vert_units(xcoordid, coord_units_us_feet, error)
492 call xf_set_spc_zone(xcoordid, ispczone, error)
494 call xf_close_group(xcoordid, error)
498 call xf_close_group(xgridid, error)
499 call xf_close_file(xfileid, error)
502 END SUBROUTINE tg_write_test_grid_cart_2d
511 SUBROUTINE tg_write_test_grid_curv_2d(Filename, Compression, error)
512 CHARACTER(LEN=*),
INTENT(IN) :: filename
513 INTEGER,
INTENT(IN) :: compression
514 INTEGER,
INTENT(OUT) :: error
516 INTEGER ncomporigin, nudir
517 INTEGER ncellsi, ncellsj
521 REAL(DOUBLE) xvals(16), yvals(16)
523 INTEGER xfileid, xgridid, xpropid, xdatasetsid, xscalarid
525 REAL(DOUBLE) dnullvalue(1)
527 REAL fdsetcellvals(6)
528 REAL fdsetcornervals(12)
529 REAL(DOUBLE) tempdouble, dcpplat, dcpplon
530 INTEGER*1 bdsetcellactive(6)
531 INTEGER*1 bdsetcorneractive(12)
533 INTEGER tmpout1, tmpout2
540 ncells = ncellsi*ncellsj
541 ncorners = (ncellsi + 1)*(ncellsj + 1)
542 ngridtype = grid_type_curvilinear
548 dnullvalue(1) = -999.0
549 norientation = orientation_right_hand
566 xvals(12) = dnullvalue(1)
580 yvals(12) = dnullvalue(1)
583 fdsetcellvals(1) = 2.1
584 fdsetcellvals(2) = 2.0
585 fdsetcellvals(3) = 1.9
586 fdsetcellvals(4) = 2.3
587 fdsetcellvals(5) = 2.5
588 fdsetcellvals(6) = dnullvalue(1)
592 bdsetcellactive(i) = 1
594 bdsetcellactive(ncells) = 0
597 fdsetcornervals(1) = 1.0
598 fdsetcornervals(2) = 0.8
599 fdsetcornervals(3) = 1.2
600 fdsetcornervals(4) = 1.4
601 fdsetcornervals(5) = 1.8
602 fdsetcornervals(6) = 2.2
603 fdsetcornervals(7) = 1.8
604 fdsetcornervals(8) = 1.4
605 fdsetcornervals(9) = 2.0
606 fdsetcornervals(10) = 1.0
607 fdsetcornervals(11) = 1.8
608 fdsetcornervals(12) = 2.2
612 bdsetcorneractive(i) = 1
614 bdsetcorneractive(ncorners) = 0
617 call xf_create_file(filename, .true., xfileid, status)
624 call xf_create_group_for_grid(xfileid, grid_curv2d_group_name, xgridid, status)
626 call xf_close_file(xfileid, error)
632 call xf_set_grid_type(xgridid, ngridtype, tmpout1)
633 call xf_set_number_of_dimensions(xgridid, ndimensions, tmpout2)
634 if ((tmpout1 < 0) .OR. (tmpout2 < 0))
then
635 call xf_close_group(xgridid, error)
636 call xf_close_file(xfileid, error)
642 call xf_set_orientation(xgridid, norientation, tmpout1)
643 if (tmpout1 < 0 )
then
644 call xf_close_group(xgridid, error)
645 call xf_close_file(xfileid, error)
651 call xf_set_computational_origin(xgridid, ncomporigin, tmpout1)
652 if (tmpout1 < 0 )
then
653 call xf_close_group(xgridid, error)
654 call xf_close_file(xfileid, error)
660 call xf_set_u_direction(xgridid, nudir, tmpout1)
661 if (tmpout1 < 0 )
then
662 call xf_close_group(xgridid, error)
663 call xf_close_file(xfileid, error)
670 call xf_set_number_cells_in_i(xgridid, ncellsi, tmpout1)
671 call xf_set_number_cells_in_j(xgridid, ncellsj, tmpout2)
672 if ((tmpout1 < 0) .OR. (tmpout2 < 0))
then
673 call xf_close_group(xgridid, error)
674 call xf_close_file(xfileid, error)
681 call xf_create_grid_property_group(xgridid, xpropid, tmpout1)
682 if (xpropid < 0)
then
683 call xf_close_group(xgridid, error)
684 call xf_close_file(xfileid, error)
689 call xf_write_property_double(xpropid, prop_null_value, 1, dnullvalue, none, &
691 if (tmpout1 < 0)
then
692 call xf_close_group(xpropid, error)
693 call xf_close_group(xgridid, error)
694 call xf_close_file(xfileid, error)
698 call xf_close_group(xpropid, error)
701 call xf_set_grid_coords_i(xgridid, ncorners, xvals, tmpout1)
702 call xf_set_grid_coords_j(xgridid, ncorners, yvals, tmpout2)
703 if ((tmpout1 < 0) .OR. (tmpout2 < 0))
then
704 call xf_close_group(xgridid, error)
705 call xf_close_file(xfileid, error)
711 call xf_create_generic_group(xgridid,
'Datasets', xdatasetsid, tmpout1)
712 if (tmpout1 < 0)
then
713 call xf_close_group(xgridid, error)
714 call xf_close_file(xfileid, error)
720 call xf_create_scalar_dataset(xdatasetsid,
'Velocity Mag',
'ft/s', ts_minutes, &
721 compression, xscalarid, tmpout1)
722 if (tmpout1 < 0)
then
723 call xf_close_group(xdatasetsid, error)
724 call xf_close_group(xgridid, error)
725 call xf_close_file(xfileid, error)
731 call xf_scalar_data_location(xscalarid, grid_loc_center, tmpout1)
732 if (tmpout1 < 0)
then
733 call xf_close_group(xscalarid, error)
734 call xf_close_group(xdatasetsid, error)
735 call xf_close_group(xgridid, error)
736 call xf_close_file(xfileid, error)
744 call xf_write_scalar_timestep(xscalarid, tempdouble, ncells, fdsetcellvals, tmpout1)
745 call xf_write_activity_timestep(xscalarid, ncells, bdsetcellactive, tmpout2)
746 if ((tmpout1 < 0) .OR. (tmpout1 < 0))
then
747 call xf_close_group(xscalarid, error)
748 call xf_close_group(xdatasetsid, error)
749 call xf_close_group(xgridid, error)
750 call xf_close_file(xfileid, error)
756 call xf_close_group(xscalarid, error)
759 call xf_create_scalar_dataset(xdatasetsid,
'elevation',
'ft', ts_minutes, &
760 compression, xscalarid, tmpout1)
761 if (tmpout1 < 0)
then
762 call xf_close_group(xdatasetsid, error)
763 call xf_close_group(xgridid, error)
764 call xf_close_file(xfileid, error)
770 call xf_scalar_data_location(xscalarid, grid_loc_corner, tmpout1)
771 if (tmpout1 < 0)
then
772 call xf_close_group(xscalarid, error)
773 call xf_close_group(xdatasetsid, error)
774 call xf_close_group(xgridid, error)
775 call xf_close_file(xfileid, error)
783 call xf_write_scalar_timestep(xscalarid, tempdouble, ncorners, fdsetcornervals, tmpout1)
784 call xf_write_activity_timestep(xscalarid, ncorners, bdsetcorneractive, tmpout2)
785 if ((tmpout1 < 0) .OR. (tmpout2 < 0))
then
786 call xf_close_group(xscalarid, error)
787 call xf_close_group(xdatasetsid, error)
788 call xf_close_group(xgridid, error)
789 call xf_close_file(xfileid, error)
797 call xf_create_coordinate_group(xfileid, xcoordid, status)
799 call xf_close_group(xscalarid, error)
800 call xf_close_group(xdatasetsid, error)
801 call xf_close_group(xgridid, error)
802 call xf_close_file(xfileid, error)
810 call xf_set_horiz_datum(xcoordid, horiz_datum_cpp, error)
811 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
813 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
814 call xf_set_vert_units(xcoordid, coord_units_meters, error)
817 call xf_set_cpp_lat(xcoordid, dcpplat, error)
818 call xf_set_cpp_lon(xcoordid, dcpplon, error)
820 call xf_close_group(xcoordid, error)
824 call xf_close_group(xscalarid, error)
825 call xf_close_group(xdatasetsid, error)
826 call xf_close_group(xgridid, error)
827 call xf_close_file(xfileid, error)
830 END SUBROUTINE tg_write_test_grid_curv_2d
839 SUBROUTINE tg_write_test_grid_cart_3d(Filename, Compression, error)
840 CHARACTER(LEN=*),
INTENT(IN) :: filename
841 INTEGER,
INTENT(IN) :: compression
842 INTEGER,
INTENT(OUT) :: error
844 INTEGER ncomporigin, nudir
845 INTEGER ncellsi, ncellsj, ncellsk
847 REAL(DOUBLE) doriginx, doriginy, doriginz
849 REAL(DOUBLE) dbearing, ddip, droll
850 REAL(DOUBLE) planesi(5), planesj(5), planesk(3)
851 INTEGER i, j, status, ispczone
852 INTEGER xfileid, xgridid, xpropid, xcoordid
855 INTEGER tmpout1, tmpout2, tmpout3
863 ngridtype = grid_type_cartesian
867 norientation = orientation_right_hand
874 ncells = ncellsi * ncellsj * ncellsk
896 active(4*ncellsj*ncellsk+4*ncellsk+1) = 0
899 call xf_create_file(filename, .true., xfileid, tmpout1)
900 if (tmpout1 < 0)
then
906 call xf_create_group_for_grid(xfileid, grid_cart3d_group_name, xgridid, tmpout1)
907 if (tmpout1 < 0)
then
908 call xf_close_file(xfileid, error)
914 call xf_set_grid_type(xgridid, ngridtype, tmpout1)
915 call xf_set_number_of_dimensions(xgridid, ndimensions, tmpout2)
916 if ((tmpout1 < 0) .OR. (tmpout2 < 0))
then
917 call xf_close_group(xgridid, error)
918 call xf_close_file(xfileid, error)
924 call xf_set_origin(xgridid, doriginx, doriginy, doriginz, tmpout1)
925 call xf_set_orientation(xgridid, norientation, tmpout2)
926 if ((tmpout1 < 0) .OR. (tmpout2 < 0))
then
927 call xf_close_group(xgridid, error)
928 call xf_close_file(xfileid, error)
934 call xf_set_bearing(xgridid, dbearing, tmpout1)
935 call xf_set_dip(xgridid, ddip, tmpout2)
936 call xf_set_roll(xgridid, droll, tmpout3)
937 if ((tmpout1 < 0) .OR. (tmpout2 < 0) .OR. (tmpout3 < 0))
then
938 call xf_close_group(xgridid, error)
939 call xf_close_file(xfileid, error)
945 call xf_set_computational_origin(xgridid, ncomporigin, tmpout1)
946 if (tmpout1 < 0)
then
947 call xf_close_group(xgridid, error)
948 call xf_close_file(xfileid, error)
954 call xf_set_u_direction(xgridid, nudir, tmpout1)
955 if (tmpout1 < 0)
then
956 call xf_close_group(xgridid, error)
957 call xf_close_file(xfileid, error)
964 call xf_set_number_cells_in_i(xgridid, ncellsi, tmpout1)
965 call xf_set_number_cells_in_j(xgridid, ncellsj, tmpout2)
966 call xf_set_number_cells_in_k(xgridid, ncellsk, tmpout3)
967 if ((tmpout1 < 0) .OR. (tmpout2 < 0) .OR. (tmpout3 < 0))
then
968 call xf_close_group(xgridid, error)
969 call xf_close_file(xfileid, error)
975 call xf_set_grid_coords_i(xgridid, ncellsi, planesi, tmpout1)
976 call xf_set_grid_coords_j(xgridid, ncellsj, planesj, tmpout2)
977 call xf_set_grid_coords_k(xgridid, ncellsk, planesk, tmpout3)
979 if ((tmpout1 < 0) .OR. (tmpout2 < 0) .OR. (tmpout3 < 0))
then
980 call xf_close_group(xgridid, error)
981 call xf_close_file(xfileid, error)
987 call xf_create_grid_cell_prop_grp(xgridid, xpropid, tmpout1)
988 if (xpropid < 0)
then
989 call xf_close_group(xgridid, error)
990 call xf_close_file(xfileid, error)
995 call xf_write_property_int(xpropid, prop_activity, ncells, active, &
996 compression, tmpout1)
998 if (tmpout1 < 0)
then
999 call xf_close_group(xpropid, error)
1000 call xf_close_group(xgridid, error)
1001 call xf_close_file(xfileid, error)
1006 call xf_close_group(xpropid, error)
1010 call xf_create_coordinate_group(xfileid, xcoordid, status)
1011 if (status < 0)
then
1012 call xf_close_group(xgridid, error)
1013 call xf_close_file(xfileid, error)
1019 call xf_set_horiz_datum(xcoordid, horiz_datum_state_plane_nad27, error)
1020 call xf_set_horiz_units(xcoordid, coord_units_us_feet, error)
1022 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
1023 call xf_set_vert_units(xcoordid, coord_units_us_feet, error)
1026 call xf_set_spc_zone(xcoordid, ispczone, error)
1028 call xf_close_group(xcoordid, error)
1032 call xf_close_group(xgridid, error)
1033 call xf_close_file(xfileid, error)
1036 END SUBROUTINE tg_write_test_grid_cart_3d
8 CHARACTER(LEN=*),
PARAMETER :: mesh_a_group_name =
'MeshA Group'
9 CHARACTER(LEN=*),
PARAMETER :: mesh_b_group_name =
'MeshB Group'
20 SUBROUTINE tm_read_mesh (xGroupId, a_OutFile, error)
21 INTEGER,
INTENT(IN) :: xgroupid
22 INTEGER,
INTENT(IN) :: a_outfile
23 INTEGER,
INTENT(OUT) :: error
24 INTEGER nelems, nnodes, nnodesperelem, nelemtype, nnodeid
25 LOGICAL*2 elementsonetype
27 INTEGER strtype, uinttype, inttype, dbltype, floattype
29 INTEGER,
ALLOCATABLE :: elemtypes(:), nodesinelem(:)
30 REAL(DOUBLE),
ALLOCATABLE :: xnodelocs(:), ynodelocs(:), znodelocs(:)
33 call xf_get_number_of_elements(xgroupid, nelems, status)
35 call xf_get_number_of_nodes(xgroupid, nnodes, status)
37 call xf_get_max_nodes_in_elem(xgroupid, nnodesperelem, status)
47 WRITE(a_outfile,*)
'Number of Elements: ', nelems
50 call xf_are_all_elems_same_type(xgroupid, elementsonetype, status)
56 if (elementsonetype)
then
57 call xf_read_elem_types_single_value(xgroupid, nelemtype, status)
58 WRITE(a_outfile,*)
'All elements are type ', nelemtype
60 allocate (elemtypes(nelems))
61 call xf_read_elem_types(xgroupid, nelems, elemtypes, status)
66 WRITE(a_outfile,*)
'Element Types:'
68 WRITE(a_outfile,*)
'Elem ', i,
', ',
'Type ', elemtypes(i)
70 deallocate (elemtypes)
74 allocate (nodesinelem(nelems*nnodesperelem))
75 call xf_read_elem_node_ids(xgroupid, nelems, nnodesperelem, nodesinelem, error)
77 WRITE (*,*)
'Error reading mesh'
82 WRITE(a_outfile,*)
'Elem: ', i,
' - '
84 nnodeid = nodesinelem((i-1)*nnodesperelem + j)
86 WRITE(a_outfile,*) nnodeid,
' '
89 WRITE (a_outfile,*)
''
92 if (
allocated(nodesinelem))
deallocate (nodesinelem)
95 allocate (xnodelocs(nnodes))
96 allocate (ynodelocs(nnodes))
97 allocate (znodelocs(nnodes))
99 call xf_read_x_node_locations(xgroupid, nnodes, xnodelocs, status)
100 if (status >= 0)
then
101 call xf_read_y_node_locations(xgroupid, nnodes, ynodelocs, status)
102 if (status >= 0)
then
103 call xf_read_z_node_locations(xgroupid, nnodes, znodelocs, status)
107 WRITE(a_outfile,*)
'Node Locations:'
109 WRITE(a_outfile,*)
'Node: ', i,
' Location: ', xnodelocs(i),
' ', &
110 ynodelocs(i),
' ', znodelocs(i)
113 deallocate (xnodelocs)
114 deallocate (ynodelocs)
115 deallocate (znodelocs)
118 call xf_open_group(xgroupid,
'PROPERTIES', xpropgroupid, status)
120 WRITE(a_outfile,*)
''
121 WRITE(a_outfile,*)
'Properties Group not found'
122 WRITE(a_outfile,*)
''
127 call xf_get_property_type(xpropgroupid,
'String', strtype, status)
128 call xf_get_property_type(xpropgroupid,
'UInt', uinttype, status)
129 call xf_get_property_type(xpropgroupid,
'Int', inttype, status)
130 call xf_get_property_type(xpropgroupid,
'Double', dbltype, status)
131 call xf_get_property_type(xpropgroupid,
'Float', floattype, status)
134 WRITE(a_outfile,*)
''
135 if (strtype == xf_type_string)
then
136 WRITE(a_outfile,*)
'String Property Type Read Correctly'
138 WRITE(a_outfile,*)
'Error in Getting String Property Type'
140 if (uinttype == xf_type_uint)
then
141 WRITE(a_outfile,*)
'Unsigned Integer Property Type Read Correctly'
143 WRITE(a_outfile,*)
'Error in Getting Unsigned Integer Property Type'
145 if (inttype == xf_type_int)
then
146 WRITE(a_outfile,*)
'Integer Property Type Read Correctly'
148 WRITE(a_outfile,*)
'Error in Getting Integer Property Type'
150 if (dbltype == xf_type_double)
then
151 WRITE(a_outfile,*)
'Double Property Type Read Correctly'
153 WRITE(a_outfile,*)
'Error in Getting Double Property Type'
155 if (floattype == xf_type_float)
then
156 WRITE(a_outfile,*)
'Float Property Type Read Correctly'
158 WRITE(a_outfile,*)
'Error in Getting Float Property Type'
160 WRITE(a_outfile,*)
''
174 SUBROUTINE tm_write_test_mesh_a (Filename, Compression, error)
175 CHARACTER(LEN=*),
INTENT(IN) :: filename
176 INTEGER,
INTENT(IN) :: compression
177 INTEGER,
INTENT(OUT) :: error
178 INTEGER nelements, nnodes
179 INTEGER xfileid, xmeshid, xpropgroupid, xcoordid
180 REAL(DOUBLE),
DIMENSION(5) :: dnodelocsx
181 REAL(DOUBLE),
DIMENSION(5) :: dnodelocsy
182 REAL(DOUBLE),
DIMENSION(5) :: dnodelocsz
183 INTEGER,
DIMENSION(3,3) :: ielementnodes
184 INTEGER status, elemtype, propint(1), iellipse
185 CHARACTER(LEN=BIG_STRING_SIZE) propstring
187 REAL(DOUBLE) propdouble(1), dmajorr, dminorr
191 elemtype = el_type_tri_linear
219 ielementnodes(1,1) = 1
220 ielementnodes(2,1) = 3
221 ielementnodes(3,1) = 2
223 ielementnodes(1,2) = 2
224 ielementnodes(2,2) = 3
225 ielementnodes(3,2) = 4
227 ielementnodes(1,3) = 5
228 ielementnodes(2,3) = 2
229 ielementnodes(3,3) = 4
232 call xf_create_file(filename, .true., xfileid, status)
235 call xf_close_file(xfileid, error)
241 call xf_create_group_for_mesh(xfileid, mesh_a_group_name, xmeshid, status)
244 call xf_close_group(xmeshid, error)
245 call xf_close_file(xfileid, error)
251 call xf_set_all_elems_same_type(xmeshid, elemtype, status)
254 call xf_close_group(xmeshid, error)
255 call xf_close_file(xfileid, error)
261 call xf_set_number_of_nodes(xmeshid, nnodes, status)
264 call xf_close_group(xmeshid, error)
265 call xf_close_file(xfileid, error)
270 call xf_write_x_node_locations(xmeshid, nnodes, dnodelocsx, compression, status)
273 call xf_close_group(xmeshid, error)
274 call xf_close_file(xfileid, error)
279 call xf_write_y_node_locations(xmeshid, nnodes, dnodelocsy, status)
282 call xf_close_group(xmeshid, error)
283 call xf_close_file(xfileid, error)
288 call xf_write_z_node_locations(xmeshid, nnodes, dnodelocsz, status)
291 call xf_close_group(xmeshid, error)
292 call xf_close_file(xfileid, error)
298 call xf_set_number_of_elements(xmeshid, nelements, status)
301 call xf_close_group(xmeshid, error)
302 call xf_close_file(xfileid, error)
308 call xf_write_elem_node_ids(xmeshid, nelements, 3, ielementnodes, &
312 call xf_close_group(xmeshid, error)
313 call xf_close_file(xfileid, error)
319 call xf_create_mesh_property_group(xmeshid, xpropgroupid, status)
321 call xf_close_group(xmeshid, error)
322 call xf_close_file(xfileid, error)
327 propstring =
'Property String'
330 propdouble = 5.6789012345d0
333 call xf_write_property_string(xpropgroupid,
'String', propstring, status)
334 call xf_write_property_uint(xpropgroupid,
'UInt', 1, propuint, none, status)
335 call xf_write_property_int(xpropgroupid,
'Int', 1, propint, none, status)
336 call xf_write_property_double(xpropgroupid,
'Double', 1, &
337 propdouble, none, status)
338 call xf_write_property_float(xpropgroupid,
'Float', 1, &
339 propfloat, none, status)
344 call xf_create_coordinate_group(xfileid, xcoordid, status)
346 call xf_close_group(xpropgroupid, error)
347 call xf_close_group(xmeshid, error)
348 call xf_close_file(xfileid, error)
358 call xf_set_horiz_datum(xcoordid, horiz_datum_geographic, error)
359 call xf_set_horiz_units(xcoordid, coord_units_us_feet, error)
361 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
362 call xf_set_vert_units(xcoordid, coord_units_us_feet, error)
365 call xf_set_ellipse(xcoordid, iellipse, error)
366 call xf_set_lat(xcoordid, latitude_north, error)
367 call xf_set_lon(xcoordid, longitude_east, error)
368 call xf_set_major_r(xcoordid, dmajorr, error)
369 call xf_set_minor_r(xcoordid, dminorr, error)
371 call xf_close_group(xcoordid, error)
375 call xf_close_group(xpropgroupid, error)
376 call xf_close_group(xmeshid, error)
377 call xf_close_file(xfileid, error)
390 SUBROUTINE tm_write_test_mesh_b (Filename, Compression, error)
391 CHARACTER(LEN=*),
INTENT(IN) :: filename
392 INTEGER,
INTENT(IN) :: compression
393 INTEGER,
INTENT(OUT) :: error
394 INTEGER nelements, nnodes, nmaxnodeperelem
395 INTEGER xfileid, xmeshid, xpropgroupid, xcoordid
396 REAL(DOUBLE),
DIMENSION(5) :: dnodelocsx
397 REAL(DOUBLE),
DIMENSION(5) :: dnodelocsy
398 REAL(DOUBLE),
DIMENSION(5) :: dnodelocsz
399 INTEGER,
DIMENSION(4,2) :: ielementnodes
400 INTEGER,
DIMENSION(2) :: ielementtypes
401 INTEGER status, propint(1), iellipse
402 CHARACTER(LEN=BIG_STRING_SIZE) propstring
404 REAL(DOUBLE) propdouble(1)
434 ielementnodes(1,1) = 1
435 ielementnodes(2,1) = 3
436 ielementnodes(3,1) = 4
437 ielementnodes(4,1) = 2
439 ielementnodes(1,2) = 2
440 ielementnodes(2,2) = 4
441 ielementnodes(3,2) = 5
442 ielementnodes(4,2) = none;
444 ielementtypes(1) = el_type_quadrilateral_linear;
445 ielementtypes(2) = el_type_tri_linear;
448 call xf_create_file(filename, .true., xfileid, status)
451 call xf_close_file(xfileid, error)
457 call xf_create_group_for_mesh(xfileid, mesh_b_group_name, xmeshid, status)
460 call xf_close_group(xmeshid, error)
461 call xf_close_file(xfileid, error)
467 call xf_set_number_of_nodes(xmeshid, nnodes, status)
470 call xf_close_group(xmeshid, error)
471 call xf_close_file(xfileid, error)
476 call xf_write_x_node_locations(xmeshid, nnodes, dnodelocsx, &
480 call xf_close_group(xmeshid, error)
481 call xf_close_file(xfileid, error)
486 call xf_write_y_node_locations(xmeshid, nnodes, dnodelocsy, status)
489 call xf_close_group(xmeshid, error)
490 call xf_close_file(xfileid, error)
495 call xf_write_z_node_locations(xmeshid, nnodes, dnodelocsz, status)
498 call xf_close_group(xmeshid, error)
499 call xf_close_file(xfileid, error)
505 call xf_set_number_of_elements(xmeshid, nelements, status)
508 call xf_close_group(xmeshid, error)
509 call xf_close_file(xfileid, error)
515 call xf_write_elem_types(xmeshid, nelements, ielementtypes, &
519 call xf_close_group(xmeshid, error)
520 call xf_close_file(xfileid, error)
526 call xf_write_elem_node_ids(xmeshid, nelements, nmaxnodeperelem, &
527 ielementnodes, compression, status)
530 call xf_close_group(xmeshid, error)
531 call xf_close_file(xfileid, error)
537 call xf_create_mesh_property_group(xmeshid, xpropgroupid, status)
539 call xf_close_group(xmeshid, error)
540 call xf_close_group(xfileid, error)
545 propstring =
'String Property'
548 propdouble = 2.3456789012d0
551 call xf_write_property_string(xpropgroupid,
'String', propstring, status)
552 call xf_write_property_uint(xpropgroupid,
'UInt', 1, propuint, none, status)
553 call xf_write_property_int(xpropgroupid,
'Int', 1, propint, none, status)
554 call xf_write_property_double(xpropgroupid,
'Double', 1, &
555 propdouble, none, status)
556 call xf_write_property_float(xpropgroupid,
'Float', 1, &
557 propfloat, none, status)
562 call xf_create_coordinate_group(xfileid, xcoordid, status)
564 call xf_close_group(xpropgroupid, error)
565 call xf_close_group(xmeshid, error)
566 call xf_close_file(xfileid, error)
574 call xf_set_horiz_datum(xcoordid, horiz_datum_geographic, error)
575 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
577 call xf_set_vert_datum(xcoordid, vert_datum_ngvd_88, error)
578 call xf_set_vert_units(xcoordid, coord_units_meters, error)
581 call xf_set_ellipse(xcoordid, iellipse, error)
582 call xf_set_lat(xcoordid, latitude_south, error)
583 call xf_set_lon(xcoordid, longitude_west, error)
585 call xf_close_group(xcoordid, error)
589 call xf_close_group(xpropgroupid, error)
590 call xf_close_group(xmeshid, error)
591 call xf_close_file(xfileid, error)
5 CHARACTER(LEN=*),
PARAMETER :: datasets_location =
'Datasets'
6 CHARACTER(LEN=*),
PARAMETER :: scalar_a_location =
'Scalars/ScalarA'
7 CHARACTER(LEN=*),
PARAMETER :: scalar_b_location =
'Scalars/ScalarB'
8 CHARACTER(LEN=*),
PARAMETER :: vector2d_a_location =
'Vectors/Vector2D_A'
9 CHARACTER(LEN=*),
PARAMETER :: vector2d_b_location =
'Vectors/Vector2D_B'
18 RECURSIVE SUBROUTINE tti_test_num_times (a_DatasetId, a_Itimestep, error)
19 INTEGER,
INTENT(IN) :: a_datasetid
20 INTEGER,
INTENT(IN) :: a_itimestep
21 INTEGER,
INTENT(OUT) :: error
28 itimestep = a_itimestep - 1
31 if (1 == itimestep .OR. 3 == itimestep .OR. 5 == itimestep)
then
33 call xf_set_dataset_num_times( a_datasetid, itimestep + 2, error )
35 WRITE(*,*)
'ERROR1: XF_SET_DATASET_NUM_TIMES must return ERROR.'
38 if (1 == itimestep)
then
41 if (3 == itimestep)
then
44 if (5 == itimestep)
then
49 call xf_set_dataset_num_times( a_datasetid, itimestep, error )
51 WRITE(*,*)
'ERROR2: xfSetDatasetNumTimes must NOT return error.'
55 call xf_set_dataset_num_times( a_datasetid, itimestep + 1, error )
57 WRITE(*,*)
'ERROR3: xfSetDatasetNumTimes must return ERROR.'
61 call xf_get_dataset_num_times( a_datasetid, numtimes, error )
63 WRITE(*,*)
'ERROR4: xfSetDatasetNumTimes must NOT return error.'
65 if (numtimes .NE. itimestep)
then
66 WRITE(*,*)
'ERROR5: xfGetDatasetNumTimes must return CORRECT NumTimes.'
80 RECURSIVE SUBROUTINE tt_read_datasets (a_xGroupId, a_FileUnit, error)
81 INTEGER,
INTENT(IN) :: a_xgroupid
82 INTEGER,
INTENT(IN) :: a_fileunit
83 INTEGER,
INTENT(OUT) :: error
84 INTEGER npaths, nmaxpathlength, j
85 CHARACTER,
ALLOCATABLE,
DIMENSION(:) :: paths
86 CHARACTER(LEN=500) individualpath
88 INTEGER xscalarid, xvectorid, xmultiid
89 INTEGER nmultidatasets
99 call xf_get_scalar_datasets_info(a_xgroupid, npaths, nmaxpathlength, nstatus)
100 if (nstatus >= 0 .AND. npaths > 0)
then
101 allocate(paths(npaths*nmaxpathlength))
102 call xf_get_scalar_dataset_paths(a_xgroupid, npaths, nmaxpathlength, paths, &
105 if (nstatus < 0)
then
111 WRITE(a_fileunit,*)
'Number of Scalars ', npaths
114 do j=1, nmaxpathlength-1
115 individualpath(j:j) = paths((i-1)*nmaxpathlength+j)
117 WRITE(a_fileunit,*)
'Reading scalar: ', individualpath(1:nmaxpathlength-1)
118 call xf_open_group(a_xgroupid, individualpath(1:nmaxpathlength-1), &
120 if (nstatus < 0)
then
125 call tti_read_scalar(xscalarid, a_fileunit, nstatus)
126 call xf_close_group(xscalarid, error)
127 if (nstatus < 0)
then
128 WRITE(*,*)
'Error reading scalar dataset.'
134 if (
allocated(paths))
deallocate(paths)
136 call xf_get_vector_datasets_info(a_xgroupid, npaths, nmaxpathlength, nstatus)
137 if (nstatus >= 0 .AND. npaths > 0)
then
138 allocate(paths(npaths*nmaxpathlength))
139 call xf_get_vector_dataset_paths(a_xgroupid, npaths, nmaxpathlength, paths, error)
141 if (nstatus < 0)
then
147 WRITE(a_fileunit,*)
'Number of Vectors ', npaths
149 do j=1, nmaxpathlength-1
150 individualpath(j:j) = paths((i-1)*nmaxpathlength+j)
152 WRITE(a_fileunit,*)
'Reading Vector: ', &
153 individualpath(1:nmaxpathlength-1)
154 call xf_open_group(a_xgroupid, individualpath(1:nmaxpathlength-1), &
156 if (nstatus < 0)
then
160 call tti_read_vector(xvectorid, a_fileunit, nstatus)
161 call xf_close_group(xvectorid, error)
162 if (nstatus < 0)
then
163 WRITE(*,*)
'Error reading vector dataset.'
169 if (
allocated(paths))
deallocate(paths)
172 call xf_get_grp_pths_sz_mlt_dsets(a_xgroupid, nmultidatasets, &
173 nmaxpathlength, nstatus)
174 if (nstatus >= 0 .AND. nmultidatasets > 0)
then
175 allocate(paths(nmultidatasets*nmaxpathlength))
176 call xf_get_all_grp_paths_mlt_dsets(a_xgroupid, nmultidatasets, &
177 nmaxpathlength, paths, error)
178 if (nstatus < 0)
then
184 WRITE(a_fileunit,*)
'Number of Multidatasets ', nmultidatasets
185 do i=2, nmultidatasets
187 do j=1, nmaxpathlength-1
188 individualpath(j:j) = paths((i-1)*nmaxpathlength+j)
190 WRITE(a_fileunit,*)
'Reading multidataset: ', &
191 individualpath(1:nmaxpathlength-1)
192 call xf_open_group(a_xgroupid, individualpath(1:nmaxpathlength-1), &
194 if (nstatus < 0)
then
199 call tt_read_datasets(xmultiid, a_fileunit, nstatus)
200 call xf_close_group(xmultiid, error)
201 if (nstatus < 0)
then
202 WRITE(*,*)
'Error reading multidatasets.'
208 if (
allocated(paths))
deallocate(paths)
220 SUBROUTINE tt_read_activity_scalar_a_index(a_Filename, a_Index, error)
221 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
222 INTEGER,
INTENT(IN) :: a_index
223 INTEGER,
INTENT(OUT) :: error
225 INTEGER xfileid, xdsetsid, xscalaraid
226 INTEGER ntimesteps, i
227 INTEGER,
ALLOCATABLE :: bactive(:)
234 call xf_open_file(a_filename, .true., xfileid, status)
241 call xf_open_group(xfileid, datasets_location, xdsetsid, status)
242 if (status >= 0)
then
243 call xf_open_group(xdsetsid, scalar_a_location, xscalaraid, status)
251 CALL xf_get_dataset_num_times(xscalaraid, ntimesteps, status)
257 if (ntimesteps < 1)
then
263 allocate(bactive(ntimesteps))
264 call xf_read_active_vals_at_index(xscalaraid, a_index, 1, ntimesteps, &
268 WRITE(*,*)
'Reading activity for scalar A slice at index: ', a_index
270 WRITE(*,*) bactive(i),
' '
286 SUBROUTINE tt_read_scalar_a_index (a_Filename, a_Index, error)
287 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
288 INTEGER,
INTENT(IN) :: a_index
289 INTEGER,
INTENT(OUT) :: error
291 INTEGER xfileid, xdsetsid, xscalaraid
292 INTEGER ntimesteps, i
293 REAL,
ALLOCATABLE :: fvalues(:)
300 call xf_open_file(a_filename, .true., xfileid, status)
307 call xf_open_group(xfileid, datasets_location, xdsetsid, status)
308 if (status >= 0)
then
309 call xf_open_group(xdsetsid, scalar_a_location, xscalaraid, status)
317 call xf_get_dataset_num_times(xscalaraid, ntimesteps, status)
323 if (ntimesteps < 1)
then
329 allocate (fvalues(ntimesteps))
330 call xf_read_scalar_values_at_index(xscalaraid, a_index, 1, ntimesteps, &
335 WRITE(*,*)
'Reading scalar A slice at index: ', a_index
337 WRITE(*,*) fvalues(i),
' '
358 SUBROUTINE tt_write_scalar_a (a_Filename, a_Compression, error)
359 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
360 INTEGER,
INTENT(IN) :: a_compression
361 INTEGER,
INTENT(OUT) :: error
362 INTEGER xfileid, xdsetsid, xscalaraid, xcoordid
363 INTEGER nvalues, ntimes, nactive
364 REAL(DOUBLE) dtime, djulianreftime
365 INTEGER itimestep, iactive, ihpgnzone
367 INTEGER*1 bactivity(10)
377 do iactive = 1, nactive
378 bactivity(iactive) = 1
384 call xf_create_file(a_filename, .true., xfileid, error)
385 if (error .LT. 0)
then
387 call xf_close_file(xfileid, error)
392 call xf_create_generic_group(xfileid, datasets_location, xdsetsid, status)
394 call xf_close_file(xfileid, error)
400 call xf_create_scalar_dataset(xdsetsid, scalar_a_location,
'mg/L', &
401 ts_hours, a_compression, xscalaraid, status)
402 if (status .LT. 0)
then
404 call xf_close_group(xscalaraid, error)
405 call xf_close_group(xdsetsid, error)
406 call xf_close_file(xfileid, error)
413 djulianreftime = 2452822.0;
414 call xf_write_reftime(xscalaraid, djulianreftime, status)
416 call xf_close_group(xscalaraid, error)
417 call xf_close_group(xdsetsid, error)
418 call xf_close_file(xfileid, error)
422 do itimestep = 1, ntimes
424 dtime = itimestep * 0.5
428 fvalues(i) = fvalues(i-1)*2.5
432 call xf_write_scalar_timestep(xscalaraid, dtime, nvalues, fvalues, error)
433 if (error .GE. 0)
then
435 call xf_write_activity_timestep(xscalaraid, nactive, bactivity, error)
438 call tti_test_num_times(xscalaraid, itimestep, error)
443 call xf_create_coordinate_group(xfileid, xcoordid, status)
445 call xf_close_group(xscalaraid, error)
446 call xf_close_group(xdsetsid, error)
447 call xf_close_file(xfileid, error)
455 call xf_set_horiz_datum(xcoordid, horiz_datum_geographic_hpgn, error)
456 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
457 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
458 call xf_set_vert_units(xcoordid, coord_units_meters, error)
461 call xf_set_hpgn_area(xcoordid, ihpgnzone, error)
463 call xf_close_group(xcoordid, error)
467 call xf_close_group(xscalaraid, error)
468 call xf_close_group(xdsetsid, error)
469 call xf_close_file(xfileid, error)
485 SUBROUTINE tt_write_scalar_b (a_Filename, a_Compression, a_Overwrite, error)
486 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
487 INTEGER,
INTENT(IN) :: a_compression
488 LOGICAL,
INTENT(IN) :: a_overwrite
489 INTEGER,
INTENT(OUT) :: error
490 INTEGER xfileid, xdsetsid, xscalarbid, xcoordid
491 INTEGER nvalues, ntimes, nactive
492 REAL(DOUBLE) dtime, djulianreftime
493 INTEGER itimestep, iactive
495 INTEGER*1 bactivity(10)
506 do iactive = 1, nactive
507 bactivity(iactive) = 1
511 if (a_overwrite)
then
513 call xf_open_file(a_filename, .false., xfileid, status)
519 call xf_open_group(xfileid, datasets_location, xdsetsid, status)
521 call xf_close_file(xfileid, error)
527 call xf_create_file(a_filename, .true., xfileid, error)
528 if (error .LT. 0)
then
530 call xf_close_file(xfileid, error)
535 call xf_create_generic_group(xfileid, datasets_location, xdsetsid, status)
537 call xf_close_file(xfileid, error)
544 call xf_create_scalar_dataset(xdsetsid, scalar_b_location,
'mg/L', &
545 ts_hours, a_compression, xscalarbid, status)
548 call xf_close_group(xscalarbid, error)
549 call xf_close_group(xdsetsid, error)
550 call xf_close_file(xfileid, error)
557 djulianreftime = 2452822.0;
558 call xf_write_reftime(xscalarbid, djulianreftime, status)
560 call xf_close_group(xscalarbid, error)
561 call xf_close_group(xdsetsid, error)
562 call xf_close_file(xfileid, error)
565 if (.NOT. a_overwrite)
then
567 do itimestep = 1, ntimes
569 dtime = itimestep * 0.5
573 fvalues(i) = fvalues(i-1)*2.5
577 call xf_write_scalar_timestep(xscalarbid, dtime, nvalues, fvalues, error)
578 if (error .GE. 0)
then
580 call xf_write_activity_timestep(xscalarbid, nactive, bactivity, error)
583 call xf_close_group(xscalarbid, error)
584 call xf_close_group(xdsetsid, error)
585 call xf_close_file(xfileid, error)
590 do itimestep = 1, ntimes
592 dtime = itimestep * 1.5
596 fvalues(i) = fvalues(i-1)*1.5
600 call xf_write_scalar_timestep(xscalarbid, dtime, nvalues, fvalues, error)
601 if (error .GE. 0)
then
603 call xf_write_activity_timestep(xscalarbid, nactive, bactivity, error)
606 call xf_close_group(xscalarbid, error)
607 call xf_close_group(xdsetsid, error)
608 call xf_close_file(xfileid, error)
613 if (.NOT. a_overwrite)
then
616 call xf_create_coordinate_group(xfileid, xcoordid, status)
618 call xf_close_group(xscalarbid, error)
619 call xf_close_group(xdsetsid, error)
620 call xf_close_file(xfileid, error)
626 call xf_set_horiz_datum(xcoordid, horiz_datum_utm, error)
627 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
629 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
630 call xf_set_vert_units(xcoordid, coord_units_meters, error)
633 call xf_set_utm_zone(xcoordid, utm_zone_max, error)
635 call xf_close_group(xcoordid, error)
640 call xf_close_group(xscalarbid, error)
641 call xf_close_group(xdsetsid, error)
642 call xf_close_file(xfileid, error)
653 SUBROUTINE tt_write_coords_to_multi (a_xFileId, error)
654 INTEGER,
INTENT(IN) :: a_xfileid
655 INTEGER,
INTENT(OUT) :: error
661 call xf_create_coordinate_group(a_xfileid, xcoordid, status)
668 call xf_set_horiz_datum(xcoordid, horiz_datum_utm, error)
669 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
671 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
672 call xf_set_vert_units(xcoordid, coord_units_meters, error)
675 call xf_set_utm_zone(xcoordid, utm_zone_max, error)
677 call xf_close_group(xcoordid, error)
693 SUBROUTINE tt_write_scalar_a_to_multi (a_GroupID, status)
697 INTEGER xfileid, xdsetsid, xscalaraid
699 INTEGER nvalues, ntimes, nactive
700 REAL(DOUBLE) dtime, djulianreftime
701 INTEGER itimestep, iactive
703 INTEGER*1 bactivity(10)
713 do iactive = 1, nactive
714 bactivity(iactive) = 1
719 call xf_create_scalar_dataset(a_groupid, scalar_a_location,
'mg/L', &
720 ts_hours, none, xscalaraid, status)
721 if (status .LT. 0)
then
723 call xf_close_group(xscalaraid, status)
724 call xf_close_group(xdsetsid, status)
725 call xf_close_file(xfileid, status)
731 djulianreftime = 2452822.0;
732 call xf_write_reftime(xscalaraid, djulianreftime, status)
734 call xf_close_group(xscalaraid, status)
735 call xf_close_group(xdsetsid, status)
736 call xf_close_file(xfileid, status)
740 do itimestep = 1, ntimes
742 dtime = itimestep * 0.5
746 fvalues(i) = fvalues(i-1)*2.5
750 call xf_write_scalar_timestep(xscalaraid, dtime, nvalues, fvalues, status)
751 if (status .GE. 0)
then
753 call xf_write_activity_timestep(xscalaraid, nactive, bactivity, status)
756 call tti_test_num_times(xscalaraid, itimestep, status)
760 call xf_close_group(xscalaraid, status)
772 SUBROUTINE tt_read_vector2d_a_index (a_Filename, a_Index, error)
773 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
774 INTEGER,
INTENT(IN) :: a_index
775 INTEGER,
INTENT(OUT) :: error
777 INTEGER xfileid, xdsetsid, xvector2da
778 INTEGER ntimesteps, i
779 REAL,
ALLOCATABLE :: fvalues(:)
786 call xf_open_file(a_filename, .true., xfileid, status)
793 call xf_open_group(xfileid, datasets_location, xdsetsid, status)
794 if (status >= 0)
then
795 call xf_open_group(xdsetsid, vector2d_a_location, xvector2da, status)
803 call xf_get_dataset_num_times(xvector2da, ntimesteps, status)
809 if (ntimesteps < 1)
then
815 allocate(fvalues(ntimesteps*2))
816 call xf_read_vector_values_at_index(xvector2da, a_index, 1, ntimesteps, 2, &
821 WRITE(*,*)
'Reading vector 2D A slice at index: ', a_index
823 WRITE(*,*) fvalues(i*2-1),
' ', fvalues(i*2)
845 SUBROUTINE tt_write_vector2d_a (a_Filename, a_Compression, error)
846 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
847 INTEGER,
INTENT(IN) :: a_compression
848 INTEGER,
INTENT(OUT) :: error
849 INTEGER xfileid, xdsetsid, xvector2d_a, xcoordid
850 INTEGER nvalues, ntimes, ncomponents, nactive
852 INTEGER itimestep, iactive
853 REAL,
DIMENSION(2, 100) :: fvalues
854 INTEGER*1 bactivity(100)
867 do iactive = 2, nactive
868 if (mod(iactive-1, 3) == 0)
then
869 bactivity(iactive) = 0
871 bactivity(iactive) = 1
876 call xf_create_file(a_filename, .true., xfileid, error)
877 if (error .LT. 0)
then
879 call xf_close_file(xfileid, error)
884 call xf_create_generic_group(xfileid, datasets_location, xdsetsid, status)
886 call xf_close_file(xfileid, error)
892 call xf_create_vector_dataset(xdsetsid, vector2d_a_location,
'ft/s', &
893 ts_seconds, a_compression, xvector2d_a, status)
894 if (status .LT. 0)
then
896 call xf_close_group(xvector2d_a, error)
897 call xf_close_group(xdsetsid, error)
898 call xf_close_file(xfileid, error)
904 do itimestep = 1, ntimes
906 dtime = itimestep * 0.5
909 do j = 1, ncomponents
910 fvalues(j,i) = ((i-1)*ncomponents + j)*dtime
915 call xf_write_vector_timestep(xvector2d_a, dtime, nvalues, ncomponents, &
917 if (error .GE. 0)
then
919 call xf_write_activity_timestep(xvector2d_a, nactive, bactivity, error)
922 call tti_test_num_times(xvector2d_a, itimestep, error)
927 call xf_create_coordinate_group(xfileid, xcoordid, status)
929 call xf_close_group(xvector2d_a, error)
930 call xf_close_group(xdsetsid, error)
931 call xf_close_file(xfileid, error)
939 call xf_set_horiz_datum(xcoordid, horiz_datum_geographic_hpgn, error)
940 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
941 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
942 call xf_set_vert_units(xcoordid, coord_units_meters, error)
945 call xf_set_hpgn_area(xcoordid, ihpgnzone, error)
947 call xf_close_group(xcoordid, error)
951 call xf_close_group(xvector2d_a, error)
952 call xf_close_group(xdsetsid, error)
953 call xf_close_file(xfileid, error)
969 SUBROUTINE tt_write_vector2d_b (a_Filename, a_Compression, a_Overwrite, error)
970 CHARACTER(LEN=*),
INTENT(IN) :: a_filename
971 INTEGER,
INTENT(IN) :: a_compression
972 LOGICAL,
INTENT(IN) :: a_overwrite
973 INTEGER,
INTENT(OUT) :: error
974 INTEGER xfileid, xdsetsid, xvector2d_b, xcoordid
975 INTEGER nvalues, ntimes, ncomponents, nactive
977 INTEGER itimestep, iactive
978 REAL,
DIMENSION(2, 100) :: fvalues
979 INTEGER*1 bactivity(100)
991 do iactive = 2, nactive
992 if (mod(iactive-1, 3) == 0)
then
993 bactivity(iactive) = 0
995 bactivity(iactive) = 1
999 if (a_overwrite)
then
1001 call xf_open_file(a_filename, .false., xfileid, status)
1002 if (status < 0)
then
1007 call xf_open_group(xfileid, datasets_location, xdsetsid, status)
1008 if (status < 0)
then
1009 call xf_close_file(xfileid, error)
1015 call xf_create_file(a_filename, .true., xfileid, error)
1016 if (error .LT. 0)
then
1018 call xf_close_file(xfileid, error)
1023 call xf_create_generic_group(xfileid, datasets_location, xdsetsid, status)
1024 if (status < 0)
then
1025 call xf_close_file(xfileid, error)
1032 call xf_create_vector_dataset(xdsetsid, vector2d_b_location,
'ft/s', &
1033 ts_seconds, a_compression, xvector2d_b, status)
1034 if (status .LT. 0)
then
1036 call xf_close_group(xvector2d_b, error)
1037 call xf_close_group(xdsetsid, error)
1038 call xf_close_file(xfileid, error)
1043 if (.NOT. a_overwrite)
then
1045 do itimestep = 1, ntimes
1047 dtime = itimestep * 0.5
1049 do j = 1, ncomponents
1050 fvalues(j,i) = ((i-1)*ncomponents + j)*dtime
1054 call xf_write_vector_timestep(xvector2d_b, dtime, nvalues, ncomponents, &
1056 if (error .GE. 0)
then
1058 call xf_write_activity_timestep(xvector2d_b, nactive, bactivity, error)
1061 call xf_close_group(xvector2d_b, error)
1062 call xf_close_group(xdsetsid, error)
1063 call xf_close_file(xfileid, error)
1068 do itimestep = 1, ntimes
1070 dtime = itimestep * 1.5
1072 do j = 1, ncomponents
1073 fvalues(j,i) = ((i-1)*ncomponents + j)*dtime
1077 call xf_write_vector_timestep(xvector2d_b, dtime, nvalues, ncomponents, &
1079 if (error .GE. 0)
then
1081 call xf_write_activity_timestep(xvector2d_b, nactive, bactivity, error)
1084 call xf_close_group(xvector2d_b, error)
1085 call xf_close_group(xdsetsid, error)
1086 call xf_close_file(xfileid, error)
1091 if (.NOT. a_overwrite)
then
1094 call xf_create_coordinate_group(xfileid, xcoordid, status)
1095 if (status < 0)
then
1096 call xf_close_group(xvector2d_b, error)
1097 call xf_close_group(xdsetsid, error)
1098 call xf_close_file(xfileid, error)
1104 call xf_set_horiz_datum(xcoordid, horiz_datum_utm, error)
1105 call xf_set_horiz_units(xcoordid, coord_units_meters, error)
1106 call xf_set_vert_datum(xcoordid, vert_datum_local, error)
1107 call xf_set_vert_units(xcoordid, coord_units_meters, error)
1110 call xf_set_utm_zone(xcoordid, utm_zone_max, error)
1112 call xf_close_group(xcoordid, error)
1117 call xf_close_group(xvector2d_b, error)
1118 call xf_close_group(xdsetsid, error)
1119 call xf_close_file(xfileid, error)
1135 SUBROUTINE tt_write_vector2d_a_to_multi (a_FileID, a_GroupID, status)
1137 INTEGER a_fileid, a_groupid
1138 INTEGER nvalues, ntimes, ncomponents, nactive
1140 INTEGER itimestep, iactive
1141 REAL,
DIMENSION(2, 100) :: fvalues
1142 INTEGER*1 bactivity(100)
1143 INTEGER i, j, status
1154 do iactive = 2, nactive
1155 if (mod(iactive-1, 3) == 0)
then
1156 bactivity(iactive) = 0
1158 bactivity(iactive) = 1
1163 call xf_create_vector_dataset(a_groupid, vector2d_a_location,
'ft/s', &
1164 ts_seconds, none, xvector2d_a, status)
1165 if (status .LT. 0)
then
1167 call xf_close_group(xvector2d_a, status)
1168 call xf_close_group(a_groupid, status)
1169 call xf_close_file(a_fileid, status)
1174 do itimestep = 1, ntimes
1176 dtime = itimestep * 0.5
1179 do j = 1, ncomponents
1180 fvalues(j,i) = ((i-1)*ncomponents + j)*dtime
1185 call xf_write_vector_timestep(xvector2d_a, dtime, nvalues, ncomponents, &
1187 if (status .GE. 0)
then
1189 call xf_write_activity_timestep(xvector2d_a, nactive, bactivity, status)
1192 call tti_test_num_times(xvector2d_a, itimestep, status)
1196 call xf_close_group(xvector2d_a, status)
1206 SUBROUTINE tti_read_scalar (a_xScalarId, FileUnit, error)
1207 INTEGER,
INTENT(IN) :: a_xscalarid
1208 INTEGER,
INTENT(IN) :: fileunit
1209 INTEGER,
INTENT(OUT) :: error
1210 INTEGER ntimes, nvalues, nactive
1211 LOGICAL*2 busereftime
1213 CHARACTER(LEN=100) timeunits
1214 REAL(DOUBLE),
ALLOCATABLE :: times(:)
1215 REAL,
ALLOCATABLE :: values(:), minimums(:), maximums(:)
1216 INTEGER,
ALLOCATABLE :: active(:)
1217 REAL(DOUBLE) reftime
1223 call xf_get_dataset_time_units(a_xscalarid, timeunits, error)
1224 if (error < 0)
return
1226 WRITE(fileunit,*)
'Time units: ', timeunits(1:len_trim(timeunits))
1229 call xf_use_reftime(a_xscalarid, busereftime, error)
1233 if (busereftime)
then
1234 call xf_read_reftime(a_xscalarid, reftime, error)
1242 call xf_get_dataset_numvals(a_xscalarid, nvalues, error)
1243 if (error .GE. 0)
then
1244 call xf_get_dataset_numactive(a_xscalarid, nactive, error)
1246 if (error .LT. 0)
return
1248 if (nvalues <= 0)
then
1249 WRITE(fileunit, *)
'No data to read in.'
1255 call xf_get_dataset_num_times(a_xscalarid, ntimes, error)
1261 allocate(times(ntimes))
1263 call xf_get_dataset_times(a_xscalarid, ntimes, times, error)
1264 if (error < 0)
return
1267 allocate(minimums(ntimes))
1268 allocate(maximums(ntimes))
1270 call xf_get_dataset_mins(a_xscalarid, ntimes, minimums, error)
1271 if (error >= 0)
then
1272 call xf_get_dataset_maxs(a_xscalarid, ntimes, maximums, error)
1276 deallocate(minimums)
1277 deallocate(maximums)
1281 allocate(values(nvalues))
1282 if (nactive .GT. 0)
then
1283 allocate(active(nactive))
1286 WRITE(fileunit,*)
'Number Timesteps: ', ntimes
1287 WRITE(fileunit,*)
'Number Values: ', nvalues
1288 WRITE(fileunit,*)
'Number Active: ', nactive
1289 WRITE(fileunit,*)
''
1293 do itime = 1, ntimes
1294 call xf_read_scalar_values_timestep(a_xscalarid, itime, nvalues, values, error)
1295 if (error >= 0 .AND. nactive > 0)
then
1296 call xf_read_activity_timestep(a_xscalarid, itime, nactive, active, error)
1301 WRITE(fileunit,*)
'Timestep at ', times(itime)
1302 WRITE(fileunit,*)
'Min: ', minimums(itime)
1303 WRITE(fileunit,*)
'Max: ', maximums(itime)
1305 WRITE(fileunit,*)
'Values:'
1306 WRITE(fileunit,*) values(1:nvalues)
1307 WRITE(fileunit,*)
''
1309 WRITE(fileunit,*)
'Activity:'
1310 WRITE(fileunit,*) active(1:nactive)
1311 WRITE(fileunit,*)
''
1314 if (
allocated(times))
then
1318 if (
allocated(minimums))
then
1319 deallocate(minimums)
1322 if (
allocated(maximums))
then
1323 deallocate(maximums)
1326 if (
allocated(values))
then
1330 if (
allocated(active))
then
1344 SUBROUTINE tti_read_vector (a_xVectorId, FileUnit, error)
1345 INTEGER,
INTENT(IN) :: a_xvectorid
1346 INTEGER,
INTENT(IN) :: fileunit
1347 INTEGER,
INTENT(OUT) :: error
1348 INTEGER ntimes, nvalues, nactive, ncomponents
1350 LOGICAL*2 busereftime
1351 CHARACTER(LEN=100) timeunits
1352 REAL(DOUBLE),
ALLOCATABLE :: times(:)
1353 REAL,
ALLOCATABLE,
DIMENSION (:, :) :: values
1354 REAL,
ALLOCATABLE :: minimums(:), maximums(:)
1355 INTEGER,
ALLOCATABLE :: active(:)
1356 REAL(DOUBLE) reftime
1364 call xf_get_dataset_time_units(a_xvectorid, timeunits, error)
1365 if (error < 0)
return
1367 WRITE(fileunit,*)
'Time units: ', timeunits(1:len_trim(timeunits))
1370 call xf_use_reftime(a_xvectorid, busereftime, error)
1374 if (busereftime)
then
1375 call xf_read_reftime(a_xvectorid, reftime, error)
1383 call xf_get_dataset_numvals(a_xvectorid, nvalues, error)
1384 if (error .GE. 0)
then
1385 call xf_get_dataset_numcomponents(a_xvectorid, ncomponents, error)
1386 if (error .GE. 0)
then
1387 call xf_get_dataset_numactive(a_xvectorid, nactive, error)
1390 if (error .LT. 0)
return
1392 if (nvalues <= 0)
then
1393 WRITE(fileunit, *)
'No data to read in.'
1399 call xf_get_dataset_num_times(a_xvectorid, ntimes, error)
1405 allocate(times(ntimes))
1407 call xf_get_dataset_times(a_xvectorid, ntimes, times, error)
1408 if (error < 0)
return
1411 allocate(minimums(ntimes))
1412 allocate(maximums(ntimes))
1414 call xf_get_dataset_mins(a_xvectorid, ntimes, minimums, error)
1415 if (error >= 0)
then
1416 call xf_get_dataset_maxs(a_xvectorid, ntimes, maximums, error)
1420 deallocate(minimums)
1421 deallocate(maximums)
1425 allocate(values(ncomponents, nvalues))
1426 if (nactive .GT. 0)
then
1427 allocate(active(nactive))
1430 WRITE(fileunit,*)
'Number Timesteps: ', ntimes
1431 WRITE(fileunit,*)
'Number Values: ', nvalues
1432 WRITE(fileunit,*)
'Number Components: ', ncomponents
1433 WRITE(fileunit,*)
'Number Active: ', nactive
1437 do itime = 1, ntimes
1438 call xf_read_vector_values_timestep(a_xvectorid, itime, nvalues, &
1439 ncomponents, values, error)
1440 if (error >= 0 .AND. nactive > 0)
then
1441 call xf_read_activity_timestep(a_xvectorid, itime, nactive, active, error)
1446 WRITE(fileunit,*)
''
1447 WRITE(fileunit,*)
'Timestep at ', times(itime)
1448 WRITE(fileunit,*)
'Min: ', minimums(itime)
1449 WRITE(fileunit,*)
'Max: ', maximums(itime)
1451 WRITE(fileunit,*)
'Values:'
1453 WRITE(fileunit,*) values(1:ncomponents,i:i)
1455 WRITE(fileunit,*)
''
1457 WRITE(fileunit,*)
'Activity:'
1458 WRITE(fileunit,*) active(1:nactive)
1459 WRITE(fileunit,*)
''
1460 WRITE(fileunit,*)
''
1464 if (
allocated(times))
then
1468 if (
allocated(minimums))
then
1469 deallocate(minimums)
1472 if (
allocated(maximums))
then
1473 deallocate(maximums)
1476 if (
allocated(values))
then
1480 if (
allocated(active))
then
1488 END MODULE testtimestep
3 INTEGER,
PARAMETER :: numtimes1 = 5
4 INTEGER,
PARAMETER :: numvalues1 = 5
5 INTEGER,
PARAMETER :: numactive1 = 3
6 INTEGER,
PARAMETER :: numtimesadd = 1
8 CHARACTER(LEN=*),
PARAMETER :: xmdf_version_out_f =
'XMDF_Version_f.txt'
9 CHARACTER(LEN=*),
PARAMETER :: mesh_a_file_f =
'mesh_a_file_f.h5'
10 CHARACTER(LEN=*),
PARAMETER :: mesh_b_file_f =
'mesh_b_file_f.h5'
11 CHARACTER(LEN=*),
PARAMETER :: mesh_a_out_f =
'mesh_a_file_f.txt'
12 CHARACTER(LEN=*),
PARAMETER :: mesh_b_out_f =
'mesh_b_file_f.txt'
14 CHARACTER(LEN=*),
PARAMETER :: grid_cart2d_a_file_f =
'grid_cart2d_a_file_f.h5'
15 CHARACTER(LEN=*),
PARAMETER :: grid_curv2d_a_file_f =
'grid_curv2d_a_file_f.h5'
16 CHARACTER(LEN=*),
PARAMETER :: grid_cart3d_a_file_f =
'grid_cart3d_a_file_f.h5'
18 CHARACTER(LEN=*),
PARAMETER :: grid_cart2d_a_out_f =
'grid_cart2d_a_out_f.txt'
19 CHARACTER(LEN=*),
PARAMETER :: grid_curv2d_a_out_f =
'grid_curv2d_a_out_f.txt'
20 CHARACTER(LEN=*),
PARAMETER :: grid_cart3d_a_out_f =
'grid_cart3d_a_out_f.txt'
22 CHARACTER(LEN=*),
PARAMETER :: multidataset_file_f =
'MultiDataSet_f.h5'
23 CHARACTER(LEN=*),
PARAMETER :: multidataset_text_f =
'MultiDataSet_f.txt'
25 CHARACTER(LEN=*),
PARAMETER :: scalar_a_file_f =
'ScalarA_f.h5'
26 CHARACTER(LEN=*),
PARAMETER :: scalar_a_text_f =
'ScalarA_f.txt'
27 CHARACTER(LEN=*),
PARAMETER :: scalar_a_pieces_file_f =
'ScalarA_Pieces_f.h5'
28 CHARACTER(LEN=*),
PARAMETER :: scalar_a_edited_file_f =
'ScalarA_edited_f.h5'
29 CHARACTER(LEN=*),
PARAMETER :: scalar_a_edited_text_f =
'ScalarA_edited_f.txt'
30 CHARACTER(LEN=*),
PARAMETER :: scalar_a_pieces_alt_file_f =
'ScalarA_Pieces_alt_f.h5'
31 CHARACTER(LEN=*),
PARAMETER :: scalar_b_file_f =
'ScalarB_f.h5'
32 CHARACTER(LEN=*),
PARAMETER :: scalar_b_text_f =
'ScalarB_f.txt'
33 CHARACTER(LEN=*),
PARAMETER :: vector2d_a_file_f =
'Vector2D_A_f.h5'
34 CHARACTER(LEN=*),
PARAMETER :: vector2d_a_text_f =
'Vector2D_A_f.txt'
35 CHARACTER(LEN=*),
PARAMETER :: vector2d_a_pieces_file_f =
'Vector2D_A_Pieces_f.h5'
36 CHARACTER(LEN=*),
PARAMETER :: vector2d_b_file_f =
'Vector2D_B_f.h5'
37 CHARACTER(LEN=*),
PARAMETER :: vector2d_b_text_f =
'Vector2D_B_f.txt'
39 CHARACTER(LEN=*),
PARAMETER :: mesh_a_file_c =
'mesh_a_file_c.h5'
40 CHARACTER(LEN=*),
PARAMETER :: mesh_b_file_c =
'mesh_b_file_c.h5'
41 CHARACTER(LEN=*),
PARAMETER :: mesh_a_out_cf =
'mesh_a_file_cf.txt'
42 CHARACTER(LEN=*),
PARAMETER :: mesh_b_out_cf =
'mesh_b_file_cf.txt'
44 CHARACTER(LEN=*),
PARAMETER :: grid_cart2d_a_file_c =
'grid_cart2d_a_file_c.h5'
45 CHARACTER(LEN=*),
PARAMETER :: grid_curv2d_a_file_c =
'grid_curv2d_a_file_c.h5'
46 CHARACTER(LEN=*),
PARAMETER :: grid_cart3d_a_file_c =
'grid_cart3d_a_file_c.h5'
48 CHARACTER(LEN=*),
PARAMETER :: grid_cart2d_a_out_cf =
'grid_cart2d_a_out_cf.txt'
49 CHARACTER(LEN=*),
PARAMETER :: grid_curv2d_a_out_cf =
'grid_curv2d_a_out_cf.txt'
50 CHARACTER(LEN=*),
PARAMETER :: grid_cart3d_a_out_cf =
'grid_cart3d_a_out_cf.txt'
52 CHARACTER(LEN=*),
PARAMETER :: scalar_a_file_c =
'ScalarA_c.h5'
53 CHARACTER(LEN=*),
PARAMETER :: scalar_a_text_cf =
'ScalarA_cf.txt'
54 CHARACTER(LEN=*),
PARAMETER :: scalar_b_file_c =
'ScalarB_c.h5'
55 CHARACTER(LEN=*),
PARAMETER :: scalar_b_text_cf =
'ScalarB_cf.txt'
56 CHARACTER(LEN=*),
PARAMETER :: vector2d_a_file_c =
'Vector2D_A_c.h5'
57 CHARACTER(LEN=*),
PARAMETER :: vector2d_a_text_cf =
'Vector2D_A_cf.txt'
58 CHARACTER(LEN=*),
PARAMETER :: vector2d_b_file_c =
'Vector2D_B_c.h5'
59 CHARACTER(LEN=*),
PARAMETER :: vector2d_b_text_cf =
'Vector2D_B_cf.txt'
61 CHARACTER(LEN=*),
PARAMETER :: calendar_out_f =
'Calendar_f.txt'
63 CHARACTER(LEN=*),
PARAMETER :: geompath_a_file_f =
'Geompath_a_file_f.h5'
64 CHARACTER(LEN=*),
PARAMETER :: geompath_a_file_f_out =
'Geompath_a_file_f_out.txt'
66 CHARACTER(LEN=*),
PARAMETER :: tt_multidataset_file_f =
'TT_MultiDataSet_f.h5'
67 CHARACTER(LEN=*),
PARAMETER :: tt_scalar_a_file_f =
'TT_ScalarA_f.h5'
68 CHARACTER(LEN=*),
PARAMETER :: tt_scalar_a_text_f =
'TT_ScalarA_f.txt'
69 CHARACTER(LEN=*),
PARAMETER :: tt_vector2d_a_file_f =
'TT_Vector2D_A_f.h5'
97 SUBROUTINE txi_test_timesteps(error)
98 INTEGER,
INTENT(OUT) :: error
99 INTEGER status, compression
100 INTEGER multifileid, multigroupid
103 CHARACTER(LEN=37) sdoguid
105 sdoguid =
'73289C80-6235-4fdc-9649-49E4F5AEB676'
110 call xf_setup_to_write_datasets(tt_multidataset_file_f,
'Multidatasets',
'', &
111 sdoguid, xf_overwrite_clear_file, multifileid, multigroupid, error)
114 call tt_write_coords_to_multi(multifileid, error)
117 call tt_write_scalar_a_to_multi(multigroupid, error)
119 call tt_write_vector2d_a_to_multi(multifileid, multigroupid, error)
121 call xf_close_group(multigroupid, status)
122 call xf_close_file(multifileid, status)
124 WRITE(*,*)
'Done writing multiple datasets...'
127 call tt_write_scalar_a(tt_scalar_a_file_f, compression, status)
133 WRITE(*,*)
'Done writing scalar datasets...'
136 call tt_write_vector2d_a(tt_vector2d_a_file_f, compression, status)
138 WRITE(*,*)
'Error writing dataset vector2D_A.'
143 WRITE(*,*)
'Done writing vector datasets...'
145 WRITE(*,*)
'Write edited scalar datasets...'
146 call td_edit_scalar_a_values(scalar_a_edited_file_f, compression, status);
152 WRITE(*,*)
'Done writing datasets...'
155 call txi_read_x_format_file(tt_scalar_a_file_f, scalar_a_text_f, status)
157 WRITE(*,*)
'Error reading SCALAR A File (see TXI_READ_X_FORMAT_FILE)'
162 call txi_read_x_format_file(scalar_a_edited_file_f, scalar_a_edited_text_f, status)
164 WRITE(*,*)
'Error reading SCALAR A Edited File (see TXI_READ_X_FORMAT_FILE)'
169 call txi_read_x_format_file(tt_vector2d_a_file_f, vector2d_a_text_f, status)
171 WRITE(*,*)
'Error reading VECTOR A Format File'
176 call txi_read_x_format_file(tt_multidataset_file_f, multidataset_text_f, status)
178 WRITE(*,*)
'Error reading Multidataset File (see TXI_READ_X_FORMAT_FILE)'
183 WRITE(*,*)
'Done reading datasets...'
185 call xf_get_num_open_identifiers(h5f_obj_all_f, numopen, error)
187 call xfi_close_open_identifiers(h5f_obj_all_f, error)
189 call xf_setup_to_write_datasets(tt_multidataset_file_f,
'Multidatasets',
'', &
190 sdoguid, xf_overwrite_clear_dataset_grp, multifileid, multigroupid, &
193 call tt_write_scalar_a_to_multi(multigroupid, error)
195 call xf_setup_to_write_datasets(tt_multidataset_file_f,
'Multidatasets',
'', &
196 sdoguid, xf_overwrite_none, multifileid, multigroupid, error)
198 call tt_write_vector2d_a_to_multi(multifileid, multigroupid, error)
201 call tt_read_scalar_a_index(tt_scalar_a_file_f, 4, status)
207 WRITE(*,*)
'Done reading scalar data at index.'
209 call tt_read_vector2d_a_index(tt_vector2d_a_file_f, 6, status)
215 WRITE(*,*)
'Done reading vector data at index.'
217 call tt_read_activity_scalar_a_index(tt_scalar_a_file_f, 6, status)
235 SUBROUTINE txi_test_datasets(error)
236 INTEGER,
INTENT(OUT) :: error
237 INTEGER status, compression
238 INTEGER multifileid, multigroupid
240 INTEGER,
PARAMETER :: nindices = 3
241 INTEGER,
DIMENSION(nIndices) :: indices
243 CHARACTER(LEN=37) sdoguid
245 sdoguid =
'73289C80-6235-4fdc-9649-49E4F5AEB676'
250 call xf_setup_to_write_datasets(multidataset_file_f,
'Multidatasets',
'', &
251 sdoguid, xf_overwrite_clear_file, multifileid, multigroupid, error)
254 call td_write_coords_to_multi(multifileid, error)
257 call td_write_scalar_a_to_multi(multigroupid, error)
259 call td_write_vector2d_a_to_multi(multifileid, multigroupid, error)
261 call xf_close_group(multigroupid, status)
262 call xf_close_file(multifileid, status)
264 WRITE(*,*)
'Done writing multiple datasets...'
267 call td_write_scalar_a(scalar_a_file_f, compression, status)
273 call td_write_scalar_a_pieces(scalar_a_pieces_file_f, compression, status)
279 call td_write_scalar_a_pieces_alt_min_max(scalar_a_pieces_alt_file_f, &
286 WRITE(*,*)
'Done writing scalar datasets...'
289 call td_write_vector2d_a(vector2d_a_file_f, compression, status)
291 WRITE(*,*)
'Error writing dataset vector2D_A.'
296 call td_write_vector2d_a_pieces(vector2d_a_pieces_file_f, compression, status)
298 WRITE(*,*)
'Error writing dataset vector2D_A.'
303 WRITE(*,*)
'Done writing vector datasets...'
305 WRITE(*,*)
'Done writing datasets...'
308 call txi_read_x_format_file(scalar_a_file_f, scalar_a_text_f, status)
310 WRITE(*,*)
'Error reading SCALAR A File (see TXI_READ_X_FORMAT_FILE)'
315 call txi_read_x_format_file(vector2d_a_file_f, vector2d_a_text_f, status)
317 WRITE(*,*)
'Error reading VECTOR A Format File'
322 call txi_read_x_format_file(multidataset_file_f, multidataset_text_f, status)
324 WRITE(*,*)
'Error reading Multidataset File (see TXI_READ_X_FORMAT_FILE)'
329 WRITE(*,*)
'Done reading datasets...'
331 call xf_get_num_open_identifiers(h5f_obj_all_f, numopen, error)
333 call xfi_close_open_identifiers(h5f_obj_all_f, error)
335 call xf_setup_to_write_datasets(multidataset_file_f,
'Multidatasets',
'', &
336 sdoguid, xf_overwrite_clear_dataset_grp, multifileid, multigroupid, &
339 call td_write_scalar_a_to_multi(multigroupid, error)
341 call xf_setup_to_write_datasets(multidataset_file_f,
'Multidatasets',
'', &
342 sdoguid, xf_overwrite_none, multifileid, multigroupid, error)
344 call td_write_vector2d_a_to_multi(multifileid, multigroupid, error)
347 call td_read_scalar_a_index(scalar_a_file_f, 4, status)
353 WRITE(*,*)
'Done reading scalar data at index.'
355 call td_read_vector2d_a_index(vector2d_a_file_f, 6, status)
361 WRITE(*,*)
'Done reading vector data at index.'
363 call td_read_activity_scalar_a_index(scalar_a_file_f, 6, status)
373 CALL td_read_scalar_a_indices(scalar_a_file_f, nindices, indices, error)
385 SUBROUTINE txi_test_overwrite_dsets(error)
386 INTEGER,
INTENT(OUT) :: error
387 INTEGER status, compression
393 call td_write_scalar_b(scalar_b_file_f, compression, .false., status)
399 call td_write_scalar_b(scalar_b_file_f, compression, .true., status)
406 call td_write_vector2d_b(vector2d_b_file_f, compression, .false., status)
408 WRITE(*,*)
'Error writing dataset vector2D_B.'
413 call td_write_vector2d_b(vector2d_b_file_f, compression, .true., status)
415 WRITE(*,*)
'Error writing dataset vector2D_B.'
421 call txi_read_x_format_file(scalar_b_file_f, scalar_b_text_f, status)
423 WRITE(*,*)
'Error reading SCALAR B File'
428 call txi_read_x_format_file(vector2d_b_file_f, vector2d_b_text_f, status)
430 WRITE(*,*)
'Error reading VECTOR B Format File'
445 SUBROUTINE txi_test_grids (error)
446 INTEGER,
INTENT(OUT) :: error
453 WRITE(*,*)
'Writing grid data.'
456 call tg_write_test_grid_cart_2d(grid_cart2d_a_file_f, error)
458 WRITE(*,*)
'Error writing grid Cartesian 2D A'
460 WRITE(*,*)
'Finished writing grid Cartesian 2D A'
462 call tg_write_test_grid_curv_2d(grid_curv2d_a_file_f, compression, error)
464 WRITE(*,*)
'Error writing grid Curvilinear 2D A'
466 WRITE(*,*)
'Finished writing grid Curvilinear 2D A'
468 call tg_write_test_grid_cart_3d(grid_cart3d_a_file_f, compression, error)
470 WRITE(*,*)
'Error writing grid Cartesian 3D A'
472 WRITE(*,*)
'Finished writing grid Cartesian 3D A'
474 call txi_read_x_format_file(grid_cart2d_a_file_f, grid_cart2d_a_out_f, error)
476 WRITE(*,*)
'Error reading grid Cartesian 2D A'
478 WRITE(*,*)
'Finished reading grid Cartesian 2D A'
480 call txi_read_x_format_file(grid_curv2d_a_file_f, grid_curv2d_a_out_f, error)
482 WRITE(*,*)
'Error reading grid Curvilinear 2D A'
484 WRITE(*,*)
'Finished reading grid Curvilinear 2D A'
486 call txi_read_x_format_file(grid_cart3d_a_file_f, grid_cart3d_a_out_f, error)
488 WRITE(*,*)
'Error reading grid Cartesian 3D A'
490 WRITE(*,*)
'Finished reading grid Cartesian 3D A'
500 SUBROUTINE txi_test_meshs (error)
501 INTEGER,
INTENT(OUT) :: error
508 call tm_write_test_mesh_a(mesh_a_file_f, compression, status)
510 WRITE(*,*)
'Error writing TestMeshA'
515 call tm_write_test_mesh_b(mesh_b_file_f, compression, status)
517 WRITE(*,*)
'Error writing TestMeshB'
522 WRITE(*,*)
'Finished writing meshes.'
525 call txi_read_x_format_file(mesh_a_file_f, mesh_a_out_f, status)
527 WRITE(*,*)
'Error reading TestMeshA'
533 call txi_read_x_format_file(mesh_b_file_f, mesh_b_out_f, status)
535 WRITE(*,*)
'Error reading TestMeshB'
540 WRITE(*,*)
'Finished reading meshes.'
554 SUBROUTINE txi_test_c (error)
555 INTEGER,
INTENT(OUT) :: error
565 call xf_open_file(scalar_a_file_c, .true., xfileid, nstatus)
567 if (nstatus < 0)
then
568 call xf_close_file(xfileid, error)
575 call xf_close_file(xfileid, error)
581 call txi_read_x_format_file(scalar_a_file_c, scalar_a_text_cf, error)
585 call txi_read_x_format_file(scalar_b_file_c, scalar_b_text_cf, error)
590 call txi_read_x_format_file(vector2d_a_file_c, vector2d_a_text_cf, error)
594 call txi_read_x_format_file(vector2d_b_file_c, vector2d_b_text_cf, error)
599 WRITE(*,*)
'Done reading C datasets...'
601 call txi_read_x_format_file(grid_cart2d_a_file_c, grid_cart2d_a_out_cf, error)
603 WRITE(*,*)
'Error reading C grid Cartesian 2D A'
605 WRITE(*,*)
'Finished reading C grid Cartesian 2D A'
607 call txi_read_x_format_file(grid_curv2d_a_file_c, grid_curv2d_a_out_cf, error)
609 WRITE(*,*)
'Error reading C grid Curvilinear 2D A'
611 WRITE(*,*)
'Finished reading C grid Curvilinear 2D A'
613 call txi_read_x_format_file(grid_cart3d_a_file_c, grid_cart3d_a_out_cf, error)
615 WRITE(*,*)
'Error reading C grid Cartesian 3D A'
617 WRITE(*,*)
'Finished reading C grid Cartesian 3D A'
620 call txi_read_x_format_file(mesh_a_file_c, mesh_a_out_cf, error)
622 WRITE(*,*)
'Error reading C TestMeshA'
627 call txi_read_x_format_file(mesh_b_file_c, mesh_b_out_cf, error)
629 WRITE(*,*)
'Error reading C TestMeshB'
633 WRITE(*,*)
'Finished reading C meshes.'
645 SUBROUTINE txi_read_x_format_file (a_XmdfFile, a_OutFile, error)
646 CHARACTER(LEN=*),
INTENT(IN) :: a_xmdffile
647 CHARACTER(LEN=*),
INTENT(IN) :: a_outfile
648 INTEGER,
INTENT(OUT) :: error
649 CHARACTER(LEN=BIG_STRING_SIZE) :: individualpath
650 CHARACTER,
ALLOCATABLE :: paths(:)
651 INTEGER xfileid, xgroupid
652 INTEGER nmeshgroups, nmaxpathlength, ngridgroups
653 INTEGER fileunit, startloc, nstatus, i, j
660 call xf_open_file(a_xmdffile, .true., xfileid, nstatus)
661 if (nstatus < 0)
then
662 call xf_close_file(xfileid, error)
669 OPEN(unit=fileunit, file=a_outfile, status=
'REPLACE', action=
'WRITE', &
671 if (fileunit == 0)
then
672 call xf_close_file(xfileid, error)
677 WRITE(fileunit,*)
'File ', a_xmdffile,
' opened.'
680 call xf_get_library_version_file(xfileid, version, error)
681 WRITE(fileunit,*)
'XMDF Version: ', version
686 call txi_test_coord_system(xfileid, fileunit, nstatus)
690 call td_read_datasets(xfileid,fileunit, nstatus)
691 if (nstatus < 0)
then
692 call xf_close_file(xfileid, error)
698 call xf_grp_pths_sz_for_meshes(xfileid, nmeshgroups, &
699 nmaxpathlength, error)
700 if (error >= 0 .AND. nmeshgroups > 0)
then
701 allocate (paths(nmaxpathlength*nmeshgroups))
702 call xf_get_group_paths_for_meshes(xfileid, nmeshgroups, nmaxpathlength, &
707 call xf_close_file(xfileid, error)
713 WRITE(fileunit,*)
'Number of meshes in file: ', nmeshgroups
714 WRITE(fileunit,*)
'Paths:'
716 do j=1, nmaxpathlength-1
717 individualpath(j:j) = paths((i-1)*nmaxpathlength+j)
719 WRITE(fileunit,*) individualpath(1:nmaxpathlength-1)
729 startloc = (i-1)*nmaxpathlength + 1
731 do j = 1, nmaxpathlength - 1
732 individualpath(j:j) = paths(startloc+j-1)
735 WRITE(fileunit,*)
'Reading mesh in group: ', &
736 individualpath(1:nmaxpathlength-1)
737 call xf_open_group(xfileid, individualpath(1:len_trim(individualpath)), &
739 if (nstatus >= 0)
then
740 call tm_read_mesh(xgroupid, fileunit, nstatus)
742 if (nstatus < 0)
then
743 WRITE(*,*)
'Error reading mesh..'
747 if (
allocated(paths))
deallocate(paths)
751 call xf_grp_pths_sz_for_grids(xfileid, ngridgroups, &
752 nmaxpathlength, nstatus)
753 if (nstatus >= 0 .AND. ngridgroups > 0)
then
754 allocate (paths(nmaxpathlength*ngridgroups))
755 call xf_get_group_paths_for_grids(xfileid, ngridgroups, &
756 nmaxpathlength, paths, nstatus)
758 if (nstatus < 0)
then
759 call xf_close_file(xfileid, error)
765 WRITE(fileunit,*)
'Number of grids in file: ', ngridgroups
766 WRITE(fileunit,*)
'Paths:'
768 do j=1, nmaxpathlength-1
769 individualpath(j:j) = paths((i-1)*nmaxpathlength+j)
771 WRITE(fileunit,*) individualpath(1:len_trim(individualpath))
780 do j = 1, nmaxpathlength - 1
781 individualpath(j:j) = paths((i-1)*nmaxpathlength+j)
783 WRITE(fileunit,*)
'Reading grid in group: ', &
784 individualpath(1:len_trim(individualpath))
785 call xf_open_group(xfileid, individualpath(1:len_trim(individualpath)), &
787 if (nstatus >= 0)
then
788 call tg_read_grid(xgroupid, fileunit, nstatus)
790 if (nstatus < 0)
then
791 WRITE(fileunit,*)
'Error reading grid..'
795 if (
allocated(paths))
deallocate(paths)
801 call xf_close_file(xfileid, error)
814 SUBROUTINE txi_test_calendar (error)
815 INTEGER,
INTENT(OUT) :: error
816 INTEGER era1, yr1, mo1, day1, hr1, min1, sec1
817 INTEGER era2, yr2, mo2, day2, hr2, min2, sec2
818 INTEGER era3, yr3, mo3, day3, hr3, min3, sec3, fileunit
819 INTEGER era4, yr4, mo4, day4, hr4, min4, sec4, calendarworks
820 DOUBLE PRECISION julian1, julian2, julian3, julian4
824 OPEN(unit=fileunit, file=calendar_out_f, status=
'REPLACE', action=
'WRITE', &
827 WRITE(fileunit,*)
'Calendar conversion:'
837 call xf_julian_to_calendar(era1, yr1, mo1, day1, hr1, min1, sec1, julian1, error)
847 call xf_calendar_to_julian(era2, yr2, mo2, day2, hr2, min2, sec2, julian2, error)
857 call xf_calendar_to_julian(era3, yr3, mo3, day3, hr3, min3, sec3, julian3, error)
866 julian4 = 2453159.5892592594_double
867 call xf_julian_to_calendar(era4, yr4, mo4, day4, hr4, min4, sec4, julian4, error)
870 WRITE(fileunit,*)
'Dates #1 & #2 were calculated with the same date:'
872 WRITE(fileunit,*) era1,
'/', yr1,
'/', mo1,
'/', day1
873 WRITE(fileunit,*)
'', hr1,
':', min1,
':',sec1,
'--- julian =',julian1
875 WRITE(fileunit,*) era2,
'/', yr2,
'/', mo2,
'/', day2
876 WRITE(fileunit,*)
'', hr2,
':', min2,
':',sec2,
'--- julian =',julian2
878 WRITE(fileunit,*)
'Dates #3 & #4 were calculated with the same date:'
880 WRITE(fileunit,*) era3,
'/', yr3,
'/', mo3,
'/', day3
881 WRITE(fileunit,*)
'', hr3,
':', min3,
':',sec3,
'--- julian =',julian3
883 WRITE(fileunit,*) era4,
'/', yr4,
'/', mo4,
'/', day4
884 WRITE(fileunit,*)
'', hr4,
':', min4,
':',sec4,
'--- julian =',julian4
886 if (era1==era2 .AND. era3==era4)
then
887 if (yr1==yr2 .AND. yr3==yr4)
then
888 if (mo1==mo2 .AND. mo3==mo4)
then
889 if (day1==day2 .AND. day3==day4)
then
890 if (hr1==hr2 .AND. hr3==hr4)
then
891 if (min1==min2 .AND. min3==min4)
then
892 if (julian1==julian2 .AND. (julian3-.0000001)<julian4 .AND. (julian3+.0000001)>julian4)
then
894 WRITE(*,*)
'Calendar conversion works correctly.'
903 if (calendarworks .NE. 1)
then
904 WRITE(*,*)
'Calendar Stuff DOES NOT Work Correctly'
917 SUBROUTINE txi_test_multi_datasets
932 SUBROUTINE txi_test_version ()
937 call xf_get_library_version(version, error)
938 WRITE(*,*)
'The current version of XMDF is: ', version
951 SUBROUTINE txi_test_coord_system (xFileId, a_OutFile, error)
952 INTEGER,
INTENT(IN) :: xfileid
953 INTEGER,
INTENT(IN) :: a_outfile
954 INTEGER,
INTENT(OUT) :: error
955 INTEGER ihorizdatum, ihorizunits, ivertdatum, ivertunits
956 INTEGER ilat, ilon, iutmzone, ispczone, ihpgnarea, iellipse
957 INTEGER bhorizdatum, nstatus
958 REAL(DOUBLE) dcpplat, dcpplon, dmajorr, dminorr
960 CHARACTER(LEN=BIG_STRING_SIZE) strhorizunits, strvertdatum
961 CHARACTER(LEN=BIG_STRING_SIZE) strvertunits
967 call xf_open_coordinate_group(xfileid, xcoordid, nstatus)
968 if (nstatus < 0)
then
969 WRITE(a_outfile,*)
''
970 WRITE(a_outfile,*)
'Coordinate Group not found'
971 WRITE(a_outfile,*)
''
977 WRITE(a_outfile,*)
''
978 WRITE(a_outfile,*)
'Coordinate System:'
980 call xf_get_horiz_datum(xcoordid, ihorizdatum, bhorizdatum)
981 call xf_get_horiz_units(xcoordid, ihorizunits, error)
982 call xf_get_vert_datum(xcoordid, ivertdatum, error)
983 call xf_get_vert_units(xcoordid, ivertunits, error)
986 if (ihorizunits == 0)
then
987 strhorizunits =
'Horizontal units = US Survey Feet (=0)'
988 else if (ihorizunits == 1)
then
989 strhorizunits =
'Horizontal units = International Feet (=1)'
990 else if (ihorizunits == 2)
then
991 strhorizunits =
'Horizontal units = Meters (=2)'
993 strhorizunits =
'ERROR in reading Horizontal units'
997 if (ivertdatum == 0)
then
998 strvertdatum =
'Vertical datum = Local (=0)'
999 else if (ivertdatum == 1)
then
1000 strvertdatum =
'Vertical datum = NGVD 29 (=1)'
1001 else if (ivertdatum == 2)
then
1002 strvertdatum =
'Vertical datum = NGVD 88 (=2)'
1004 strvertdatum =
'ERROR in reading the Vertical datum'
1008 if (ivertunits == 0)
then
1009 strvertunits =
'Vertical units = US Survey Feet (=0)'
1010 else if (ivertunits == 1)
then
1011 strvertunits =
'Vertical units = International Feet (=1)'
1012 else if (ivertunits == 2)
then
1013 strvertunits =
'Vertical units = Meters (=2)'
1015 strvertunits =
'ERROR in reading the Vertical units'
1018 if (bhorizdatum >= 0)
then
1019 SELECT CASE (ihorizdatum)
1020 CASE (horiz_datum_geographic)
1021 call xf_get_ellipse(xcoordid, iellipse, error)
1022 call xf_get_lat(xcoordid, ilat, error)
1023 call xf_get_lon(xcoordid, ilon, error)
1025 WRITE(a_outfile,*)
'Horizontal datum = Geographic'
1026 WRITE(a_outfile,*)
'Horizontal units = ', strhorizunits(1:len_trim(strhorizunits))
1027 WRITE(a_outfile,*)
'Vertical datum = ', strvertdatum(1:len_trim(strvertdatum))
1028 WRITE(a_outfile,*)
'Vertical units = ', strvertunits(1:len_trim(strvertunits))
1031 WRITE(a_outfile,*)
' Latitude = North (=0)'
1032 else if (ilat == 1)
then
1033 WRITE(a_outfile,*)
' Latitude = South (=1)'
1035 WRITE(a_outfile,*)
' LATITUDE INFO INCORRECT'
1039 WRITE(a_outfile,*)
' Longitude = East (=0)'
1040 else if (ilon == 1)
then
1041 WRITE(a_outfile,*)
' Longitude = West (=1)'
1043 WRITE(a_outfile,*)
' LONGITUDE INFO INCORRECT'
1047 if (iellipse == 32)
then
1048 WRITE(a_outfile,*)
'Ellipse = User-defined:'
1049 call xf_get_major_r(xcoordid, dmajorr, error)
1050 call xf_get_minor_r(xcoordid, dminorr, error)
1051 WRITE(a_outfile,*)
' MajorR = ', dmajorr
1052 WRITE(a_outfile,*)
' MinorR = ', dminorr
1054 WRITE(a_outfile,*)
'Ellipse = ', iellipse
1056 WRITE(a_outfile,*)
''
1057 CASE (horiz_datum_utm)
1058 call xf_get_utm_zone(xcoordid, iutmzone, error)
1060 if (ihorizdatum == horiz_datum_utm)
then
1061 WRITE(a_outfile,*)
'Horizontal datum = UTM'
1062 else if (ihorizdatum == horiz_datum_utm_nad27)
then
1063 WRITE(a_outfile,*)
'Horizontal datum = UTM NAD27 (US)'
1065 WRITE(a_outfile,*)
'Horizontal datum = UTM NAD83 (US)'
1067 WRITE(a_outfile,*)
'Horizontal units = ', &
1068 strhorizunits(1:len_trim(strhorizunits))
1069 WRITE(a_outfile,*)
'Vertical datum = ', &
1070 strvertdatum(1:len_trim(strvertdatum))
1071 WRITE(a_outfile,*)
'Vertical units = ', &
1072 strvertunits(1:len_trim(strvertunits))
1073 WRITE(a_outfile,*)
'UTM Zone = ', iutmzone
1074 WRITE(a_outfile,*)
''
1076 CASE (horiz_datum_utm_nad27, horiz_datum_utm_nad83)
1077 call xf_get_utm_zone(xcoordid, iutmzone, error)
1079 if (ihorizdatum == horiz_datum_utm)
then
1080 WRITE(a_outfile,*)
'Horizontal datum = UTM'
1081 else if (ihorizdatum == horiz_datum_utm_nad27)
then
1082 WRITE(a_outfile,*)
'Horizontal datum = UTM NAD27 (US)'
1084 WRITE(a_outfile,*)
'Horizontal datum = UTM NAD83 (US)'
1086 WRITE(a_outfile,*)
'Horizontal units = ', &
1087 strhorizunits(1:len_trim(strhorizunits))
1088 WRITE(a_outfile,*)
'Vertical datum = ', &
1089 strvertdatum(1:len_trim(strvertdatum))
1090 WRITE(a_outfile,*)
'Vertical units = ', &
1091 strvertunits(1:len_trim(strvertunits))
1092 WRITE(a_outfile,*)
'UTM Zone = ', iutmzone
1093 WRITE(a_outfile,*)
''
1094 CASE (horiz_datum_state_plane_nad27, horiz_datum_state_plane_nad83)
1095 call xf_get_spc_zone(xcoordid, ispczone, error)
1097 if (ihorizdatum == horiz_datum_state_plane_nad27)
then
1098 WRITE(a_outfile,*)
'Horizontal datum = State Plane NAD27 (US)'
1100 WRITE(a_outfile,*)
'Horizontal datum = State Plane NAD83 (US)'
1102 WRITE(a_outfile,*)
'Horizontal units = ', &
1103 strhorizunits(1:len_trim(strhorizunits))
1104 WRITE(a_outfile,*)
'Vertical datum = ', &
1105 strvertdatum(1:len_trim(strvertdatum))
1106 WRITE(a_outfile,*)
'Vertical units = ', &
1107 strvertunits(1:len_trim(strvertunits))
1108 WRITE(a_outfile,*)
'SPC Zone = ', ispczone
1109 WRITE(a_outfile,*)
''
1110 CASE (horiz_datum_utm_hpgn, horiz_datum_state_plane_hpgn, &
1111 horiz_datum_geographic_hpgn)
1112 call xf_get_hpgn_area(xcoordid, ihpgnarea, error)
1113 if (ihorizdatum == horiz_datum_utm_hpgn)
then
1114 WRITE(a_outfile,*)
'Horizontal datum = UTM HPGN (US)'
1115 else if (ihorizdatum == horiz_datum_state_plane_hpgn)
then
1116 WRITE(a_outfile,*)
'Horizontal datum = State Plane HPGN (US)'
1118 WRITE(a_outfile,*)
'Horizontal datum = Geographic HPGN (US)'
1120 WRITE(a_outfile,*)
'Horizontal units = ', &
1121 strhorizunits(1:len_trim(strhorizunits))
1122 WRITE(a_outfile,*)
'Vertical datum = ', &
1123 strvertdatum(1:len_trim(strvertdatum))
1124 WRITE(a_outfile,*)
'Vertical units = ', &
1125 strvertunits(1:len_trim(strvertunits))
1126 WRITE(a_outfile,*)
'HPGN Area = ', ihpgnarea
1127 WRITE(a_outfile,*)
''
1128 CASE (horiz_datum_cpp)
1129 call xf_get_cpp_lat(xcoordid, dcpplat, error)
1130 call xf_get_cpp_lon(xcoordid, dcpplon, error)
1131 WRITE(a_outfile,*)
'Horizontal datum = CPP (Carte Parallelo-Grammatique Projection)'
1132 WRITE(a_outfile,*)
'Horizontal units = ', &
1133 strhorizunits(1:len_trim(strhorizunits))
1134 WRITE(a_outfile,*)
'Vertical datum = ', &
1135 strvertdatum(1:len_trim(strvertdatum))
1136 WRITE(a_outfile,*)
'Vertical units = ', &
1137 strvertunits(1:len_trim(strvertunits))
1138 WRITE(a_outfile,*)
'CPP Latitude = ', dcpplat
1139 WRITE(a_outfile,*)
'CPP Longitude = ', dcpplon
1140 WRITE(a_outfile,*)
''
1141 CASE (horiz_datum_local, horiz_datum_geographic_nad27, &
1142 horiz_datum_geographic_nad83)
1144 if (ihorizdatum == horiz_datum_local)
then
1145 WRITE(a_outfile,*)
'Horizontal datum = Local'
1146 else if (ihorizdatum == horiz_datum_geographic_nad27)
then
1147 WRITE(a_outfile,*)
'Horizontal datum = Geographic NAD27 (US)'
1149 WRITE(a_outfile,*)
'Horizontal datum = Geographic NAD83 (US)'
1151 WRITE(a_outfile,*)
'Horizontal units = ', &
1152 strhorizunits(1:len_trim(strhorizunits))
1153 WRITE(a_outfile,*)
'Vertical datum = ', &
1154 strvertdatum(1:len_trim(strvertdatum))
1155 WRITE(a_outfile,*)
'Vertical units = ', &
1156 strvertunits(1:len_trim(strvertunits))
1157 WRITE(a_outfile,*)
''
1159 WRITE(a_outfile,*)
'ERROR: The coordinate information is not found in the .h5 file'
1164 WRITE(a_outfile,*)
'Coordinate information in HDF5 file is incomplete.'
1165 WRITE(a_outfile,*)
''
1168 call xf_close_group(xcoordid, error)
1175 SUBROUTINE txi_test_geometric_paths(error)
1176 INTEGER,
INTENT(OUT) :: error
1183 WRITE(*,*)
'Writing geometric path data'
1186 call tm_write_test_paths(geompath_a_file_f, compression, error);
1188 WRITE(*,*)
'Error writing geometric path data A'
1191 WRITE(*,*)
'Finished writing geometric path data A'
1194 call tm_read_test_paths(geompath_a_file_f, geompath_a_file_f_out, error)
1198 END SUBROUTINE txi_test_geometric_paths
1202 END MODULE testsmodule
1215 call xf_initialize(error)
1218 call txi_test_timesteps(error)
1220 WRITE(*,*)
'Error in writing timesteps!'
1221 pause
'Press ENTER to exit...'
1225 call txi_test_datasets(error)
1227 WRITE(*,*)
'Error in writing datasets!'
1228 pause
'Press ENTER to exit...'
1232 call txi_test_overwrite_dsets(error)
1234 WRITE(*,*)
'Error in overwriting datasets!'
1235 pause
'Press ENTER to exit...'
1237 WRITE(*,*)
'Finished writing datasets...'
1241 call txi_test_meshs(error)
1243 WRITE(*,*)
'Error in TXI_TEST_MESHS!'
1244 pause
'Press ENTER to exit...'
1248 call txi_test_grids(error)
1250 WRITE(*,*)
'Error in TXI_TEST_GRIDS!'
1251 pause
'Press ENTER to exit...'
1255 call txi_test_c(error)
1259 call txi_test_calendar(error)
1261 WRITE(*,*)
'Error in TXI_TEST_CALENDAR!'
1262 pause
'Press ENTER to exit...'
1266 call txi_test_version
1269 call txi_test_geometric_paths(error)
1271 WRITE(*,*)
'Error in TXI_TEST_GEOMETRIC_PATHS!'
1272 pause
'Press ENTER to exit...'
1275 call xf_close(error)
1277 WRITE(*,*)
'Error in XF_CLOSE!'
1278 pause
'Press ENTER to exit...'