Changeset 3997


Ignore:
Timestamp:
May 23, 2019 12:35:57 PM (5 years ago)
Author:
eckhard
Message:

inifor: Read origin_z from static driver if given; alert user to warnings

Location:
palm/trunk/UTIL/inifor
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/UTIL/inifor/src/inifor.f90

    r3866 r3997  
    2626! -----------------
    2727! $Id$
     28! Alert user to warnings if any
     29!
     30!
     31! 3866 2019-04-05 14:25:01Z eckhard
    2832! Use PALM's working precision
    2933! Show error message if compiled without netCDF support
     
    185189!
    186190!-- Initialize the netCDF output file and define dimensions
    187     CALL setup_netcdf_dimensions(output_file, palm_grid, cfg%start_date,    &
    188                                  origin_lon, origin_lat)
     191    CALL setup_netcdf_dimensions( output_file, palm_grid, cfg%start_date,      &
     192                                  origin_lon, origin_lat )
    189193    CALL log_runtime( 'time', 'write' )
    190194
     
    587591    CALL log_runtime( 'report', 'void' )
    588592
    589     message = "Finished writing dynamic driver '" // TRIM( output_file%name ) // &
    590               "' successfully."
     593    message = "Finished writing dynamic driver '" // TRIM( output_file%name )
     594   
     595    IF ( n_wrngs > 0 )  THEN
     596       message = TRIM( message ) // "' with " // TRIM( str( n_wrngs ) ) //     &
     597       " warning(s). Please see logfile '" // LOG_FILE_NAME // "'."
     598    ELSE
     599       message = TRIM( message ) // "' successfully."
     600    END IF
     601
    591602    CALL report( 'main loop', message )
    592603    CALL close_log
  • palm/trunk/UTIL/inifor/src/inifor_control.f90

    r3866 r3997  
    2626! -----------------
    2727! $Id$
     28! Added warnings counter
     29!
     30!
     31! 3866 2019-04-05 14:25:01Z eckhard
    2832! Use PALM's working precision
    2933! Renamed run_control -> log_runtime
     
    8589    CHARACTER (LEN=5000) ::  tip     = '' !< optional log message buffer for tips on how to rectify encountered errors
    8690    INTEGER, SAVE        ::  u            !< Fortran file unit for the log file
     91    INTEGER, SAVE        ::  n_wrngs = 0  !< Fortran file unit for the log file
    8792
    8893 CONTAINS
     
    143148    CHARACTER(LEN=*), INTENT(IN) ::  message !< log message
    144149
     150    n_wrngs = n_wrngs + 1
    145151    CALL report(routine, "WARNING: " // TRIM(message))
    146152
  • palm/trunk/UTIL/inifor/src/inifor_defs.f90

    r3867 r3997  
    2626! -----------------
    2727! $Id$
     28! Defined netCDF attribute names for PALM origin coordinates
     29! Make netCDF variable names constants
     30! Bumped version number
     31!
     32!
     33! 3867 2019-04-05 16:15:55Z eckhard
    2834! Added parameter for INIFOR's log file name
    2935! Use PALM's working precision
     
    145151 REAL(wp), PARAMETER ::  CP_PALM = 1005.0_wp  !< heat capacity of dry air at constant pressure, used in computation of PALM-4U's potential temperature [J/kg/K]
    146152
     153!
     154!-- PALM static driver attribute names (PIDS 1.9)
     155CHARACTER(SNAME), PARAMETER ::  PIDS_ORIGIN_LON = 'origin_lon'
     156CHARACTER(SNAME), PARAMETER ::  PIDS_ORIGIN_LAT = 'origin_lat'
     157CHARACTER(SNAME), PARAMETER ::  PIDS_ORIGIN_Z   = 'origin_z'
     158
    147159!
    148160!-- COSMO netCDF names
    149 CHARACTER(SNAME) ::  NC_DEPTH_NAME = 'depth_2'
    150 CHARACTER(SNAME) ::  NC_HHL_NAME = 'HHL'
    151 CHARACTER(SNAME) ::  NC_RLAT_NAME = 'rlat'
    152 CHARACTER(SNAME) ::  NC_RLON_NAME = 'rlon'
    153 CHARACTER(SNAME) ::  NC_ROTATED_POLE_NAME = 'rotated_pole'
    154 CHARACTER(SNAME) ::  NC_POLE_LATITUDE_NAME = 'grid_north_pole_latitude'
    155 CHARACTER(SNAME) ::  NC_POLE_LONGITUDE_NAME = 'grid_north_pole_longitude'
     161CHARACTER(SNAME), PARAMETER ::  NC_DEPTH_NAME = 'depth_2'
     162CHARACTER(SNAME), PARAMETER ::  NC_HHL_NAME = 'HHL'
     163CHARACTER(SNAME), PARAMETER ::  NC_RLAT_NAME = 'rlat'
     164CHARACTER(SNAME), PARAMETER ::  NC_RLON_NAME = 'rlon'
     165CHARACTER(SNAME), PARAMETER ::  NC_ROTATED_POLE_NAME = 'rotated_pole'
     166CHARACTER(SNAME), PARAMETER ::  NC_POLE_LATITUDE_NAME = 'grid_north_pole_latitude'
     167CHARACTER(SNAME), PARAMETER ::  NC_POLE_LONGITUDE_NAME = 'grid_north_pole_longitude'
    156168
    157169!
     
    164176    ACHAR( 10 ) // ' Copyright 2017-2019 Deutscher Wetterdienst Offenbach' !< Copyright notice
    165177 CHARACTER(LEN=*), PARAMETER ::  LOG_FILE_NAME = 'inifor.log' !< Name of INIFOR's log file
    166  CHARACTER(LEN=*), PARAMETER ::  VERSION = '1.4.9rc'          !< INIFOR version number
     178 CHARACTER(LEN=*), PARAMETER ::  VERSION = '1.4.9          !< INIFOR version number
    167179 
    168180 END MODULE inifor_defs
  • palm/trunk/UTIL/inifor/src/inifor_grid.f90

    r3866 r3997  
    2626! -----------------
    2727! $Id$
     28! Read origin_z from static driver if given on the command line
     29! Warn if origin_z is specified twice (by static driver and --elevation)
     30!
     31!
     32! 3866 2019-04-05 14:25:01Z eckhard
    2833! Use PALM's working precision
    2934! Catch errors while reading namelists
     
    140145               SNAME, LNAME, PATH, FORCING_STEP, WATER_ID, FILL_ITERATIONS,    &
    141146               BETA, P_SL, T_SL, BETA, RD, RV, G, P_REF, RD_PALM, CP_PALM,     &
    142                RHO_L, OMEGA, HECTO, wp, iwp
     147               RHO_L, OMEGA, HECTO, wp, iwp,                                   &
     148               PIDS_ORIGIN_LON,                                                &
     149               PIDS_ORIGIN_LAT,                                                &
     150               PIDS_ORIGIN_Z
    143151    USE inifor_io,                                                             &
    144152        ONLY:  get_cosmo_grid, get_netcdf_attribute, get_netcdf_dim_vector,    &
     
    440448
    441449    output_file%name = cfg%output_file
    442     z0 = cfg%z0
    443     p0 = cfg%p0
    444450
    445451    init_variables_required = .TRUE.
     
    536542    IF (TRIM(cfg%static_driver_file) .NE. '')  THEN
    537543
    538        origin_lon = get_netcdf_attribute(cfg%static_driver_file, 'origin_lon')
    539        origin_lat = get_netcdf_attribute(cfg%static_driver_file, 'origin_lat')
     544       origin_lon = get_netcdf_attribute(cfg%static_driver_file, TRIM( PIDS_ORIGIN_LON ) )
     545       origin_lat = get_netcdf_attribute(cfg%static_driver_file, TRIM( PIDS_ORIGIN_LAT ) )
     546       z0         = get_netcdf_attribute(cfg%static_driver_file, TRIM( PIDS_ORIGIN_Z ) )
     547
    540548
    541549       message = TRIM(message) // " static driver file '"                   &
     
    556564
    557565    CALL report('setup_parameters', message)
     566
     567    IF ( cfg%z0_is_set .AND. TRIM( cfg%static_driver_file ) .NE. '' )  THEN
     568
     569       message = 'You specified both --static-driver/-t and --elevation/-z0. ' // &
     570                 'Using the command line value (' // TRIM( real_to_str_f( cfg%z0 ) ) // &
     571                 ') instead of static driver value (' // TRIM( real_to_str_f( z0 ) ) // ').'
     572       CALL warn('setup_parameters', message)
     573
     574       z0 = cfg%z0
     575
     576    END IF
     577
     578    p0 = cfg%p0
    558579
    559580    CALL log_runtime('time', 'read')
  • palm/trunk/UTIL/inifor/src/inifor_io.f90

    r3866 r3997  
    2626! -----------------
    2727! $Id$
     28! Added boolean indicator for --elevation option invocation
     29! Stop INIFOR if no command-line options given
     30!
     31!
     32! 3866 2019-04-05 14:25:01Z eckhard
    2833! Use PALM's working precision
    2934! Improved coding style
     
    143148!------------------------------------------------------------------------------!
    144149    INTERFACE get_netcdf_variable
    145         MODULE PROCEDURE get_netcdf_variable_int
    146         MODULE PROCEDURE get_netcdf_variable_real
     150       MODULE PROCEDURE get_netcdf_variable_int
     151       MODULE PROCEDURE get_netcdf_variable_real
    147152    END INTERFACE get_netcdf_variable
    148153
     
    411416    INTEGER                            ::  arg_count, i
    412417
    413     cfg%p0_is_set = .FALSE.
    414     cfg%ug_defined_by_user = .FALSE.
    415     cfg%vg_defined_by_user = .FALSE.
    416418    cfg%flow_prefix_is_set = .FALSE.
    417419    cfg%input_prefix_is_set = .FALSE.
     420    cfg%p0_is_set = .FALSE.
    418421    cfg%radiation_prefix_is_set = .FALSE.
    419422    cfg%soil_prefix_is_set = .FALSE.
    420423    cfg%soilmoisture_prefix_is_set = .FALSE.
     424    cfg%ug_defined_by_user = .FALSE.
     425    cfg%vg_defined_by_user = .FALSE.
     426    cfg%z0_is_set = .FALSE.
    421427
    422428    arg_count = COMMAND_ARGUMENT_COUNT()
     
    448454
    449455             CASE( '-z0', '-z', '--elevation' )
     456                cfg%z0_is_set = .TRUE.
    450457                CALL get_option_argument( i, arg )
    451458                READ(arg, *) cfg%z0
     
    552559    ELSE
    553560         
    554        message = "No arguments present, using default input and output files"
    555        CALL report('parse_command_line_arguments', message)
     561       CALL print_version
     562       CALL report( 'parse_command_line_arguments', 'No arguments present, exiting.' )
     563       STOP
    556564
    557565    ENDIF
     
    559567 END SUBROUTINE parse_command_line_arguments
    560568
    561    
     569
    562570
    563571 SUBROUTINE get_datetime_file_list( start_date_string, start_hour, end_hour, &
  • palm/trunk/UTIL/inifor/src/inifor_types.f90

    r3866 r3997  
    2626! -----------------
    2727! $Id$
     28! Added boolean indicator for --elevation option invocation, sorted varibles
     29!
     30!
     31! 3866 2019-04-05 14:25:01Z eckhard
    2832! Use PALM's working precision
    2933!
     
    117121   
    118122    LOGICAL              ::  debug                       !< indicates whether --debug option was given
    119     LOGICAL              ::  p0_is_set                   !< indicates whether p0 was set manually
    120     LOGICAL              ::  ug_defined_by_user          !< indicates whether ug was set manually
    121     LOGICAL              ::  vg_defined_by_user          !< indicates whether vg was set manually
    122123    LOGICAL              ::  flow_prefix_is_set          !< indicates whether the flow prefix was set manually
    123124    LOGICAL              ::  input_prefix_is_set         !< indicates whether the input prefix was set manually
     125    LOGICAL              ::  p0_is_set                   !< indicates whether p0 was set manually
    124126    LOGICAL              ::  radiation_prefix_is_set     !< indicates whether the radiation prefix was set manually
    125127    LOGICAL              ::  soil_prefix_is_set          !< indicates whether the soil prefix was set manually
    126128    LOGICAL              ::  soilmoisture_prefix_is_set  !< indicates whether the soilmoisture prefix was set manually
     129    LOGICAL              ::  ug_defined_by_user          !< indicates whether ug was set manually
     130    LOGICAL              ::  vg_defined_by_user          !< indicates whether vg was set manually
     131    LOGICAL              ::  z0_is_set                   !< indicates whether z0 was set manually
    127132 END TYPE inifor_config
    128133
Note: See TracChangeset for help on using the changeset viewer.