5#include "test_macros.inc"
13 use,
INTRINSIC :: iso_c_binding
21 SUBROUTINE write_dummy_scrip_grid_file_c ( &
22 grid_name, grid_filename, mask_filename, &
23 with_corner, num_lon, num_lat, lon_range, lat_range ) &
24 bind( c, name=
'write_dummy_scrip_grid_file' )
25 use,
INTRINSIC :: iso_c_binding, only : c_char, c_int, c_size_t, c_double
26 CHARACTER(KIND=c_char),
DIMENSION(*) :: grid_name
27 CHARACTER(KIND=c_char),
DIMENSION(*) :: grid_filename
28 CHARACTER(KIND=c_char),
DIMENSION(*) :: mask_filename
29 INTEGER(KIND=c_int),
value :: with_corner
30 INTEGER(KIND=c_size_t),
value :: num_lon
31 INTEGER(KIND=c_size_t),
value :: num_lat
32 REAL(KIND=c_double),
DIMENSION(*) :: lat_range
33 REAL(KIND=c_double),
DIMENSION(*) :: lon_range
34 END SUBROUTINE write_dummy_scrip_grid_file_c
38 SUBROUTINE c_unlink ( path ) bind ( c, name='unlink' )
39 use,
INTRINSIC :: iso_c_binding, only : c_char
40 CHARACTER(KIND=c_char),
DIMENSION(*) :: path
41 END SUBROUTINE c_unlink
51 CALL test_yac_read_scrip_basic_grid()
56 CALL test_yac_read_scrip_cloud_basic_grid()
63 SUBROUTINE test_yac_read_scrip_basic_grid()
67 CHARACTER(KIND=c_char,LEN=*),
PARAMETER :: grid_name = &
68 "dummy_grid" // c_null_char
69 CHARACTER(KIND=c_char,LEN=*),
PARAMETER :: grid_filename = &
70 "test_read_scrip_grids.nc" // c_null_char
71 CHARACTER(KIND=c_char,LEN=*),
PARAMETER :: mask_filename = &
72 "test_read_scrip_masks.nc" // c_null_char
74 INTEGER(KIND=C_INT),
PARAMETER :: with_corner = 1_c_int
75 INTEGER(KIND=C_INT),
PARAMETER :: valid_mask_value = 0_c_int
76 INTEGER(KIND=C_INT),
PARAMETER :: use_ll_edges = 0_c_int
78 INTEGER(KIND=C_SIZE_T) :: cell_coord_idx
79 TYPE(C_PTR) :: duplicated_cell_idx
80 TYPE(C_PTR) :: orig_cell_global_id
81 INTEGER(KIND=C_SIZE_T) :: nbr_duplicated_cells
83 TYPE(C_PTR) :: scrip_grid
86 CALL write_dummy_scrip_grid_file_c( &
87 grid_name, grid_filename, mask_filename, with_corner, &
88 360_c_size_t, 10_c_size_t, (/0.0_c_double, 360.0_c_double/), &
89 (/0.0_c_double, 10.0_c_double/))
93 grid_filename, mask_filename, grid_name, &
94 valid_mask_value, grid_name, use_ll_edges, cell_coord_idx, &
95 duplicated_cell_idx, orig_cell_global_id, nbr_duplicated_cells)
103 CALL c_unlink(grid_filename)
104 CALL c_unlink(mask_filename)
106 END SUBROUTINE test_yac_read_scrip_basic_grid
108 SUBROUTINE test_yac_read_scrip_cloud_basic_grid()
112 CHARACTER(KIND=c_char,LEN=*),
PARAMETER :: grid_name = &
113 "dummy_grid" // c_null_char
114 CHARACTER(KIND=c_char,LEN=*),
PARAMETER :: grid_filename = &
115 "test_read_scrip_cloud_grids.nc" // c_null_char
116 CHARACTER(KIND=c_char,LEN=*),
PARAMETER :: mask_filename = &
117 "test_read_scrip_cloud_masks.nc" // c_null_char
119 INTEGER(KIND=C_INT),
PARAMETER :: with_corner = 0_c_int
120 INTEGER(KIND=C_INT),
PARAMETER :: valid_mask_value = 0_c_int
122 INTEGER(KIND=C_SIZE_T) :: vertex_coord_idx
123 TYPE(C_PTR) :: duplicated_vertex_idx
124 TYPE(C_PTR) :: orig_vertex_global_id
125 INTEGER(KIND=C_SIZE_T) :: nbr_duplicated_vertices
127 TYPE(C_PTR) :: scrip_cloud_grid
130 CALL write_dummy_scrip_grid_file_c( &
131 grid_name, grid_filename, mask_filename, with_corner, &
132 380_c_size_t, 180_c_size_t, (/0.0_c_double, 380.0_c_double/), &
133 (/-90.0_c_double, 90.0_c_double/))
137 grid_filename, mask_filename, grid_name, &
138 valid_mask_value, grid_name, vertex_coord_idx, &
139 duplicated_vertex_idx, orig_vertex_global_id, nbr_duplicated_vertices)
141 CALL test(nbr_duplicated_vertices == 20 * 180)
149 CALL c_unlink(grid_filename)
150 CALL c_unlink(mask_filename)
152 END SUBROUTINE test_yac_read_scrip_cloud_basic_grid
subroutine, public start_test(name)
subroutine, public stop_test()
subroutine, public exit_tests()