Changeset 3729 for palm/trunk/SOURCE/netcdf_interface_mod.f90
- Timestamp:
- Feb 8, 2019 4:53:32 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/netcdf_interface_mod.f90
r3727 r3729 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Bugfix: - initialize return values to ensure they are set before returning 28 ! (routine define_geo_coordinates) 29 ! - change order of dimensions for some variables 30 ! 31 ! 3727 2019-02-08 14:52:10Z gronemeier 27 32 ! make several routines publicly available 28 33 ! … … 511 516 id_var_zw_xy, id_var_zw_xz, id_var_zw_yz, id_var_zw_3d 512 517 513 INTEGER(iwp), DIMENSION(0: 1,0:2) :: id_var_eutm_3d, id_var_nutm_3d, &518 INTEGER(iwp), DIMENSION(0:2,0:1) :: id_var_eutm_3d, id_var_nutm_3d, & 514 519 id_var_eutm_xy, id_var_nutm_xy, & 515 520 id_var_eutm_xz, id_var_nutm_xz, & 516 521 id_var_eutm_yz, id_var_nutm_yz 517 522 518 INTEGER(iwp), DIMENSION(0: 1,0:2) :: id_var_lat_3d, id_var_lon_3d, &523 INTEGER(iwp), DIMENSION(0:2,0:1) :: id_var_lat_3d, id_var_lon_3d, & 519 524 id_var_lat_xy, id_var_lon_xy, & 520 525 id_var_lat_xz, id_var_lon_xz, & … … 564 569 id_var_zusi_mask, id_var_zwwi_mask 565 570 566 INTEGER(iwp), DIMENSION( 1:max_masks,0:1,0:2) :: id_var_eutm_mask, &571 INTEGER(iwp), DIMENSION(0:2,1:max_masks,0:1) :: id_var_eutm_mask, & 567 572 id_var_nutm_mask 568 573 569 INTEGER(iwp), DIMENSION( 1:max_masks,0:1,0:2) :: id_var_lat_mask, &574 INTEGER(iwp), DIMENSION(0:2,1:max_masks,0:1) :: id_var_lat_mask, & 570 575 id_var_lon_mask 571 576 … … 1029 1034 (/ id_dim_x_mask(mid,av), id_dim_xu_mask(mid,av) /), & 1030 1035 (/ id_dim_y_mask(mid,av), id_dim_yv_mask(mid,av) /), & 1031 id_var_eutm_mask( mid,av,:), id_var_nutm_mask(mid,av,:), &1032 id_var_lat_mask( mid,av,:), id_var_lon_mask(mid,av,:) )1036 id_var_eutm_mask(:,mid,av), id_var_nutm_mask(:,mid,av), & 1037 id_var_lat_mask(:,mid,av), id_var_lon_mask(:,mid,av) ) 1033 1038 ! 1034 1039 !-- Define coordinate-reference system … … 1303 1308 1304 1309 nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), & 1305 id_var_eutm_mask( mid,av,k), &1310 id_var_eutm_mask(k,mid,av), & 1306 1311 netcdf_data, start = (/ 1 /), & 1307 1312 count = (/ mask_size(mid,1) /) ) … … 1332 1337 1333 1338 nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), & 1334 id_var_nutm_mask( mid,av,k), &1339 id_var_nutm_mask(k,mid,av), & 1335 1340 netcdf_data, start = (/ 1 /), & 1336 1341 count = (/ mask_size(mid,2) /) ) … … 1371 1376 1372 1377 nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), & 1373 id_var_eutm_mask( mid,av,k), &1378 id_var_eutm_mask(k,mid,av), & 1374 1379 netcdf_data_2d, start = (/ 1, 1 /), & 1375 1380 count = (/ mask_size(mid,1), & … … 1386 1391 1387 1392 nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), & 1388 id_var_nutm_mask( mid,av,k), &1393 id_var_nutm_mask(k,mid,av), & 1389 1394 netcdf_data_2d, start = (/ 1, 1 /), & 1390 1395 count = (/ mask_size(mid,1), & … … 1433 1438 1434 1439 nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), & 1435 id_var_lon_mask( mid,av,k), &1440 id_var_lon_mask(k,mid,av), & 1436 1441 lon, start = (/ 1, 1 /), & 1437 1442 count = (/ mask_size(mid,1), & … … 1440 1445 1441 1446 nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), & 1442 id_var_lat_mask( mid,av,k), &1447 id_var_lat_mask(k,mid,av), & 1443 1448 lat, start = (/ 1, 1 /), & 1444 1449 count = (/ mask_size(mid,1), & … … 1778 1783 (/ id_dim_x_3d(av), id_dim_xu_3d(av) /), & 1779 1784 (/ id_dim_y_3d(av), id_dim_yv_3d(av) /), & 1780 id_var_eutm_3d( av,:), id_var_nutm_3d(av,:), &1781 id_var_lat_3d( av,:), id_var_lon_3d(av,:) )1785 id_var_eutm_3d(:,av), id_var_nutm_3d(:,av), & 1786 id_var_lat_3d(:,av), id_var_lon_3d(:,av) ) 1782 1787 ! 1783 1788 !-- Define coordinate-reference system … … 2098 2103 ENDDO 2099 2104 2100 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_eutm_3d( av,k),&2105 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_eutm_3d(k,av),& 2101 2106 netcdf_data, start = (/ 1 /), & 2102 2107 count = (/ nx+1 /) ) … … 2128 2133 ENDDO 2129 2134 2130 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_nutm_3d( av,k),&2135 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_nutm_3d(k,av),& 2131 2136 netcdf_data, start = (/ 1 /), & 2132 2137 count = (/ ny+1 /) ) … … 2166 2171 ENDDO 2167 2172 2168 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_eutm_3d( av,k), &2173 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_eutm_3d(k,av), & 2169 2174 netcdf_data_2d, start = (/ 1, 1 /), & 2170 2175 count = (/ nx+1, ny+1 /) ) … … 2179 2184 ENDDO 2180 2185 2181 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_nutm_3d( av,k), &2186 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_nutm_3d(k,av), & 2182 2187 netcdf_data_2d, start = (/ 1, 1 /), & 2183 2188 count = (/ nx+1, ny+1 /) ) … … 2249 2254 ENDDO 2250 2255 2251 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_lon_3d( av,k), &2256 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_lon_3d(k,av), & 2252 2257 lon, start = (/ nxl+1, nys+1 /), & 2253 2258 count = (/ nxr-nxl+1, nyn-nys+1 /) ) 2254 2259 CALL netcdf_handle_error( 'netcdf_define_header', 556 ) 2255 2260 2256 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_lat_3d( av,k), &2261 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_lat_3d(k,av), & 2257 2262 lat, start = (/ nxl+1, nys+1 /), & 2258 2263 count = (/ nxr-nxl+1, nyn-nys+1 /) ) … … 2760 2765 (/ id_dim_x_xy(av), id_dim_xu_xy(av) /), & 2761 2766 (/ id_dim_y_xy(av), id_dim_yv_xy(av) /), & 2762 id_var_eutm_xy( av,:), id_var_nutm_xy(av,:), &2763 id_var_lat_xy( av,:), id_var_lon_xy(av,:) )2767 id_var_eutm_xy(:,av), id_var_nutm_xy(:,av), & 2768 id_var_lat_xy(:,av), id_var_lon_xy(:,av) ) 2764 2769 ! 2765 2770 !-- Define coordinate-reference system … … 3154 3159 ENDDO 3155 3160 3156 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_eutm_xy( av,k),&3161 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_eutm_xy(k,av),& 3157 3162 netcdf_data, start = (/ 1 /), & 3158 3163 count = (/ nx+1 /) ) … … 3184 3189 ENDDO 3185 3190 3186 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_nutm_xy( av,k),&3191 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_nutm_xy(k,av),& 3187 3192 netcdf_data, start = (/ 1 /), & 3188 3193 count = (/ ny+1 /) ) … … 3222 3227 ENDDO 3223 3228 3224 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_eutm_xy( av,k), &3229 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_eutm_xy(k,av), & 3225 3230 netcdf_data_2d, start = (/ 1, 1 /), & 3226 3231 count = (/ nx+1, ny+1 /) ) … … 3235 3240 ENDDO 3236 3241 3237 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_nutm_xy( av,k), &3242 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_nutm_xy(k,av), & 3238 3243 netcdf_data_2d, start = (/ 1, 1 /), & 3239 3244 count = (/ nx+1, ny+1 /) ) … … 3284 3289 ENDDO 3285 3290 3286 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_lon_xy( av,k), &3291 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_lon_xy(k,av), & 3287 3292 lon, start = (/ nxl+1, nys+1 /), & 3288 3293 count = (/ nxr-nxl+1, nyn-nys+1 /) ) 3289 3294 CALL netcdf_handle_error( 'netcdf_define_header', 556 ) 3290 3295 3291 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_lat_xy( av,k), &3296 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_lat_xy(k,av), & 3292 3297 lat, start = (/ nxl+1, nys+1 /), & 3293 3298 count = (/ nxr-nxl+1, nyn-nys+1 /) ) … … 3687 3692 (/ id_dim_x_xz(av), id_dim_xu_xz(av) /), & 3688 3693 (/ id_dim_y_xz(av), id_dim_yv_xz(av) /), & 3689 id_var_eutm_xz( av,:), id_var_nutm_xz(av,:), &3690 id_var_lat_xz( av,:), id_var_lon_xz(av,:) )3694 id_var_eutm_xz(:,av), id_var_nutm_xz(:,av), & 3695 id_var_lat_xz(:,av), id_var_lon_xz(:,av) ) 3691 3696 ! 3692 3697 !-- Define coordinate-reference system … … 4035 4040 ENDDO 4036 4041 4037 nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_eutm_xz( av,k),&4042 nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_eutm_xz(k,av),& 4038 4043 netcdf_data, start = (/ 1 /), & 4039 4044 count = (/ nx+1 /) ) … … 4069 4074 ENDDO 4070 4075 4071 nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_nutm_xz( av,k),&4076 nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_nutm_xz(k,av),& 4072 4077 netcdf_data, start = (/ 1 /), & 4073 4078 count = (/ ns /) ) … … 4111 4116 ENDDO 4112 4117 4113 nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_eutm_xz( av,k), &4118 nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_eutm_xz(k,av), & 4114 4119 netcdf_data_2d, start = (/ 1, 1 /), & 4115 4120 count = (/ nx+1, ns /) ) … … 4128 4133 ENDDO 4129 4134 4130 nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_nutm_xz( av,k), &4135 nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_nutm_xz(k,av), & 4131 4136 netcdf_data_2d, start = (/ 1, 1 /), & 4132 4137 count = (/ nx+1, ns /) ) … … 4178 4183 ENDDO 4179 4184 4180 nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_lon_xz( av,k), &4185 nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_lon_xz(k,av), & 4181 4186 lon, start = (/ 1, 1 /), & 4182 4187 count = (/ nx+1, ns /) ) 4183 4188 CALL netcdf_handle_error( 'netcdf_define_header', 556 ) 4184 4189 4185 nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_lat_xz( av,k), &4190 nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_lat_xz(k,av), & 4186 4191 lat, start = (/ 1, 1 /), & 4187 4192 count = (/ nx+1, ns /) ) … … 4546 4551 (/ id_dim_x_yz(av), id_dim_xu_yz(av) /), & 4547 4552 (/ id_dim_y_yz(av), id_dim_yv_yz(av) /), & 4548 id_var_eutm_yz( av,:), id_var_nutm_yz(av,:), &4549 id_var_lat_yz( av,:), id_var_lon_yz(av,:) )4553 id_var_eutm_yz(:,av), id_var_nutm_yz(:,av), & 4554 id_var_lat_yz(:,av), id_var_lon_yz(:,av) ) 4550 4555 ! 4551 4556 !-- Define coordinate-reference system … … 4884 4889 ENDDO 4885 4890 4886 nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_eutm_yz( av,k),&4891 nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_eutm_yz(k,av),& 4887 4892 netcdf_data, start = (/ 1 /), & 4888 4893 count = (/ ns /) ) … … 4914 4919 ENDDO 4915 4920 4916 nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_nutm_yz( av,k),&4921 nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_nutm_yz(k,av),& 4917 4922 netcdf_data, start = (/ 1 /), & 4918 4923 count = (/ ny+1 /) ) … … 4956 4961 ENDDO 4957 4962 4958 nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_eutm_yz( av,k), &4963 nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_eutm_yz(k,av), & 4959 4964 netcdf_data_2d, start = (/ 1, 1 /), & 4960 4965 count = (/ ns, ny+1 /) ) … … 4973 4978 ENDDO 4974 4979 4975 nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_nutm_yz( av,k), &4980 nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_nutm_yz(k,av), & 4976 4981 netcdf_data_2d, start = (/ 1, 1 /), & 4977 4982 count = (/ ns, ny+1 /) ) … … 5023 5028 ENDDO 5024 5029 5025 nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_lon_yz( av,k), &5030 nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_lon_yz(k,av), & 5026 5031 lon, start = (/ 1, 1 /), & 5027 5032 count = (/ ns, ny+1 /) ) 5028 5033 CALL netcdf_handle_error( 'netcdf_define_header', 556 ) 5029 5034 5030 nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_lat_yz( av,k), &5035 nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_lat_yz(k,av), & 5031 5036 lat, start = (/ 1, 1 /), & 5032 5037 count = (/ ns, ny+1 /) ) … … 7234 7239 INTEGER(iwp), DIMENSION(0:2), INTENT(OUT) :: id_var_nutm !< variable id for N_UTM coordinates 7235 7240 7241 ! 7242 !-- Initialize return values 7243 id_var_lat = -1 7244 id_var_lon = -1 7245 id_var_eutm = -1 7246 id_var_nutm = -1 7247 7236 7248 #if defined( __netcdf ) 7237 7238 7249 ! 7239 7250 !-- Define UTM coordinates
Note: See TracChangeset
for help on using the changeset viewer.