Changeset 4421
- Timestamp:
- Feb 24, 2020 3:33:45 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/virtual_measurement_mod.f90
r4408 r4421 25 25 ! ----------------- 26 26 ! $Id$ 27 ! - Output of character string station_name after DOM has been enabled to 28 ! output character variables 29 ! - Bugfix, missing coupling char statement when opening the input file 30 ! 31 ! 4408 2020-02-14 10:04:39Z gronemeier 27 32 ! write fill_value attribute 28 33 ! … … 111 116 !> which allows for straight-forward comparison of model results with 112 117 !> observations. 113 !>114 !> @todo Check why there is an error when _FillValue attributes are added via115 !> dom.116 !> @todo Output of character variable station_name (dom hasn't this feature117 !> yet implemented).118 118 !------------------------------------------------------------------------------! 119 119 MODULE virtual_measurement_mod … … 882 882 ! 883 883 !-- Open the input file. 884 CALL open_read_file( input_file_vm , pids_id )884 CALL open_read_file( input_file_vm // TRIM( coupling_char ), pids_id ) 885 885 ! 886 886 !-- Obtain number of sites. … … 1462 1462 ! 1463 1463 !-- Define output file. 1464 WRITE( vmea(l)%nc_filename, '(A,I4.4)' )'VM_OUTPUT' // &1464 WRITE( vmea(l)%nc_filename, '(A,I4.4)' ) 'VM_OUTPUT' // & 1465 1465 TRIM( coupling_char ) // '/' //& 1466 1466 'site', l … … 1615 1615 dimension_name = 'max_name_len', & 1616 1616 output_type = 'int32', & 1617 bounds = (/1_iwp, 32_iwp/),&1617 bounds = (/1_iwp, maximum_name_length /), & 1618 1618 values_int32 = ndim ) 1619 1619 DEALLOCATE( ndim ) … … 1628 1628 output_type = 'real32' ) 1629 1629 ! 1630 !-- station_name . DOM needs to be enabled to define CHARACTER variables.1631 !variable_name = 'station_name'1632 !return_value = dom_def_var( vmea(l)%nc_filename, &1633 !variable_name = variable_name, &1634 !dimension_names = (/ 'max_name_len', &1635 ! 'station '/),&1636 !output_type = 'char' )1630 !-- station_name 1631 variable_name = 'station_name' 1632 return_value = dom_def_var( vmea(l)%nc_filename, & 1633 variable_name = variable_name, & 1634 dimension_names = (/ 'max_name_len', & 1635 'station ' /), & 1636 output_type = 'char' ) 1637 1637 ! 1638 1638 !-- vrs (vertical reference system) … … 1966 1966 variable_name = variable_name, & 1967 1967 dimension_names = (/ 'max_name_len', & 1968 'station_soil' /),&1968 'station_soil' /), & 1969 1969 output_type = 'char' ) 1970 1970 ! … … 2260 2260 2261 2261 CHARACTER(LEN=100) :: variable_name !< name of output variable 2262 2263 INTEGER(iwp) :: l !< loop index 2264 INTEGER(iwp) :: n !< loop index 2262 CHARACTER(LEN=maximum_name_length), DIMENSION(:), ALLOCATABLE :: station_name !< string for station name, consecutively ordered 2263 2264 CHARACTER(LEN=1), DIMENSION(:,:), ALLOCATABLE, TARGET :: output_values_2d_char_target !< target for output name arrays 2265 CHARACTER(LEN=1), DIMENSION(:,:), POINTER :: output_values_2d_char_pointer !< pointer for output name arrays 2266 2267 INTEGER(iwp) :: l !< loop index for the number of sites 2268 INTEGER(iwp) :: n !< loop index for observation points 2269 INTEGER(iwp) :: nn !< loop index for number of characters in a name 2265 2270 INTEGER :: return_value !< returned status value of called function 2266 2271 … … 2347 2352 DEALLOCATE( oro_rel ) 2348 2353 DEALLOCATE( output_values_1d_target ) 2354 ! 2355 !-- Write station name 2356 ALLOCATE ( station_name(vmea(l)%start_coord_a:vmea(l)%end_coord_a) ) 2357 ALLOCATE ( output_values_2d_char_target(vmea(l)%start_coord_a:vmea(l)%end_coord_a, & 2358 1:maximum_name_length) ) 2359 2360 DO n = vmea(l)%start_coord_a, vmea(l)%end_coord_a 2361 station_name(n) = REPEAT( ' ', maximum_name_length ) 2362 WRITE( station_name(n), '(A,I10.10)') "station", n 2363 DO nn = 1, maximum_name_length 2364 output_values_2d_char_target(n,nn) = station_name(n)(nn:nn) 2365 ENDDO 2366 ENDDO 2367 2368 output_values_2d_char_pointer => output_values_2d_char_target 2369 2370 return_value = & 2371 dom_write_var( vmea(l)%nc_filename, & 2372 'station_name', & 2373 values_char_2d = output_values_2d_char_pointer,& 2374 bounds_start = (/ 1, vmea(l)%start_coord_a /),& 2375 bounds_end = (/ maximum_name_length, vmea(l)%end_coord_a /) ) 2376 2377 DEALLOCATE( station_name ) 2378 DEALLOCATE( output_values_2d_char_target ) 2349 2379 ! 2350 2380 !-- In case of sampled soil quantities, output also the respective … … 2414 2444 DEALLOCATE( output_values_1d_target ) 2415 2445 ! 2416 !-- Write the stations name 2446 !-- Write station name 2447 ALLOCATE ( station_name(vmea(l)%start_coord_s:vmea(l)%end_coord_s) ) 2448 ALLOCATE ( output_values_2d_char_target(vmea(l)%start_coord_s:vmea(l)%end_coord_s, & 2449 1:maximum_name_length) ) 2450 2451 DO n = vmea(l)%start_coord_s, vmea(l)%end_coord_s 2452 station_name(n) = REPEAT( ' ', maximum_name_length ) 2453 WRITE( station_name(n), '(A,I10.10)') "station", n 2454 DO nn = 1, maximum_name_length 2455 output_values_2d_char_target(n,nn) = station_name(n)(nn:nn) 2456 ENDDO 2457 ENDDO 2458 output_values_2d_char_pointer => output_values_2d_char_target 2459 2460 return_value = & 2461 dom_write_var( vmea(l)%nc_filename, & 2462 'station_name_soil', & 2463 values_char_2d = output_values_2d_char_pointer,& 2464 bounds_start = (/ 1, vmea(l)%start_coord_s /),& 2465 bounds_end = (/ maximum_name_length, vmea(l)%end_coord_s /) ) 2466 2467 DEALLOCATE( station_name ) 2468 DEALLOCATE( output_values_2d_char_target ) 2417 2469 2418 2470 ENDIF
Note: See TracChangeset
for help on using the changeset viewer.