- Timestamp:
- Jan 17, 2019 2:12:17 PM (6 years ago)
- Location:
- palm/trunk/UTIL/inifor
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/UTIL/inifor/README
r3613 r3678 1 # INIFOR - Mesoscale Interface for Initializing and Forcing PALM-4U (v1.4. 3)1 # INIFOR - Mesoscale Interface for Initializing and Forcing PALM-4U (v1.4.4) 2 2 3 3 INIFOR provides the meteorological fields required to initialize and drive the -
palm/trunk/UTIL/inifor/src/inifor_control.f90
r3618 r3678 26 26 ! ----------------- 27 27 ! $Id$ 28 ! Added message buffer for displaying tips to rectify encountered errors 29 ! 30 ! 31 ! 3618 2018-12-10 13:25:22Z eckhard 28 32 ! Prefixed all INIFOR modules with inifor_ 29 33 ! … … 73 77 74 78 CHARACTER (LEN=5000) :: message = '' !< log message buffer 79 CHARACTER (LEN=5000) :: tip = '' !< optional log message buffer for tips on how to rectify encountered errors 75 80 76 81 CONTAINS -
palm/trunk/UTIL/inifor/src/inifor_defs.f90
r3618 r3678 26 26 ! ----------------- 27 27 ! $Id$ 28 ! Bumped version number 29 ! 30 ! 31 ! 3618 2018-12-10 13:25:22Z eckhard 28 32 ! Prefixed module with inifor_ 29 33 ! … … 127 131 INTEGER, PARAMETER :: FORCING_STEP = 1 !< Number of hours between forcing time steps [h] 128 132 REAL(dp), PARAMETER :: NUDGING_TAU = 21600.0_dp !< Nudging relaxation time scale [s] 129 CHARACTER(LEN=*), PARAMETER :: VERSION = '1.4. 3' !< INIFOR version number133 CHARACTER(LEN=*), PARAMETER :: VERSION = '1.4.4' !< INIFOR version number 130 134 CHARACTER(LEN=*), PARAMETER :: COPYRIGHT = 'Copyright 2017-2018 Leibniz Universitaet Hannover' // & 131 135 ACHAR( 10 ) // ' Copyright 2017-2018 Deutscher Wetterdienst Offenbach' !< Copyright notice -
palm/trunk/UTIL/inifor/src/inifor_grid.f90
r3618 r3678 26 26 ! ----------------- 27 27 ! $Id$ 28 ! bugfix: Avoid empty averaging regions for small PALM domains 29 ! change: moved get_input_file_list() to io module 30 ! 31 ! 32 ! 3618 2018-12-10 13:25:22Z eckhard 28 33 ! Prefixed all INIFOR modules with inifor_, removed unused variables 29 34 ! … … 112 117 ONLY: get_netcdf_attribute, get_netcdf_dim_vector, & 113 118 get_netcdf_variable, parse_command_line_arguments, & 114 validate_config119 get_input_file_list, validate_config 115 120 USE inifor_transform, & 116 121 ONLY: average_2d, rotate_to_cosmo, find_horizontal_neighbours,& … … 1625 1630 dlat = cosmo_lat(1) - cosmo_lat(0) 1626 1631 1627 imin = CEILING( (avg_grid % lon(1) - cosmo_lon(0)) / dlon )1628 imax = FLOOR( (avg_grid % lon(2) - cosmo_lon(0)) / dlon )1629 1630 jmin = CEILING( (avg_grid % lat(1) - cosmo_lat(0)) / dlat )1631 jmax = FLOOR( (avg_grid % lat(2) - cosmo_lat(0)) / dlat )1632 imin = FLOOR ( (avg_grid % lon(1) - cosmo_lon(0)) / dlon ) 1633 imax = CEILING( (avg_grid % lon(2) - cosmo_lon(0)) / dlon ) 1634 1635 jmin = FLOOR ( (avg_grid % lat(1) - cosmo_lat(0)) / dlat ) 1636 jmax = CEILING( (avg_grid % lat(2) - cosmo_lat(0)) / dlat ) 1632 1637 1633 1638 message = "Averaging '" // TRIM(avg_grid % kind) // "' over "// & … … 3641 3646 3642 3647 3643 SUBROUTINE get_input_file_list(start_date_string, start_hour, end_hour, &3644 step_hour, path, prefix, suffix, file_list)3645 3646 CHARACTER (LEN=DATE), INTENT(IN) :: start_date_string3647 CHARACTER (LEN=*), INTENT(IN) :: prefix, suffix, path3648 INTEGER, INTENT(IN) :: start_hour, end_hour, step_hour3649 CHARACTER(LEN=*), ALLOCATABLE, INTENT(INOUT) :: file_list(:)3650 3651 INTEGER :: number_of_intervals, hour, i3652 CHARACTER(LEN=DATE) :: date_string3653 3654 number_of_intervals = CEILING( REAL(end_hour - start_hour) / step_hour )3655 ALLOCATE( file_list(number_of_intervals + 1) )3656 3657 DO i = 0, number_of_intervals3658 hour = start_hour + i * step_hour3659 date_string = add_hours_to(start_date_string, hour)3660 3661 file_list(i+1) = TRIM(path) // TRIM(prefix) // TRIM(date_string) // &3662 TRIM(suffix) // '.nc'3663 message = "Set up input file name '" // TRIM(file_list(i+1)) //"'"3664 CALL report('input_file_list', message)3665 END DO3666 3667 END SUBROUTINE get_input_file_list3668 3669 3670 3648 !------------------------------------------------------------------------------! 3671 3649 ! Description: -
palm/trunk/UTIL/inifor/src/inifor_io.f90
r3618 r3678 26 26 ! ----------------- 27 27 ! $Id$ 28 ! Moved get_input_file_list() here from grid module, added check for presence of 29 ! input files 30 ! 31 ! 32 ! 33 ! 34 ! 3618 2018-12-10 13:25:22Z eckhard 28 35 ! Prefixed all INIFOR modules with inifor_ 29 36 ! … … 98 105 USE inifor_types 99 106 USE inifor_util, & 100 ONLY: reverse, str, real_to_str107 ONLY: add_hours_to, reverse, str, real_to_str 101 108 USE netcdf 102 109 … … 529 536 530 537 538 539 SUBROUTINE get_datetime_file_list( start_date_string, start_hour, end_hour, & 540 step_hour, input_path, prefix, suffix, & 541 file_list ) 542 543 CHARACTER (LEN=DATE), INTENT(IN) :: start_date_string 544 CHARACTER (LEN=*), INTENT(IN) :: prefix, suffix, input_path 545 INTEGER, INTENT(IN) :: start_hour, end_hour, step_hour 546 CHARACTER(LEN=*), ALLOCATABLE, INTENT(INOUT) :: file_list(:) 547 548 INTEGER :: number_of_intervals, hour, i 549 CHARACTER(LEN=DATE) :: date_string 550 551 number_of_intervals = CEILING( REAL(end_hour - start_hour) / step_hour ) 552 ALLOCATE( file_list(number_of_intervals + 1) ) 553 554 DO i = 0, number_of_intervals 555 556 hour = start_hour + i * step_hour 557 date_string = add_hours_to(start_date_string, hour) 558 559 file_list(i+1) = TRIM(input_path) // TRIM(prefix) // & 560 TRIM(date_string) // TRIM(suffix) // '.nc' 561 562 message = "Set up input file name '" // TRIM(file_list(i+1)) // "'" 563 CALL report('input_file_list', message) 564 565 END DO 566 567 END SUBROUTINE get_datetime_file_list 568 569 !------------------------------------------------------------------------------! 570 ! Description: 571 ! ------------ 572 !> Establish a list of files based on the given start and end times and file 573 !> prefixes and suffixes. 574 !------------------------------------------------------------------------------! 575 SUBROUTINE get_input_file_list( start_date_string, start_hour, end_hour, & 576 step_hour, input_path, prefix, suffix, & 577 file_list ) 578 579 CHARACTER (LEN=DATE), INTENT(IN) :: start_date_string 580 CHARACTER (LEN=*), INTENT(IN) :: prefix, suffix, input_path 581 INTEGER, INTENT(IN) :: start_hour, end_hour, step_hour 582 CHARACTER(LEN=*), ALLOCATABLE, INTENT(INOUT) :: file_list(:) 583 584 INTEGER :: number_of_intervals, hour, i 585 CHARACTER(LEN=DATE) :: date_string 586 CHARACTER(LEN=PATH) :: file_name 587 588 CALL get_datetime_file_list( start_date_string, start_hour, end_hour, & 589 step_hour, input_path, prefix, suffix, & 590 file_list ) 591 592 tip = "Please check if you specified the correct file prefix " // & 593 "using the options --input-prefix, --flow-prefix, etc." 594 595 DO i = 1, SIZE(file_list) 596 CALL verify_file(file_list(i), 'input', tip) 597 END DO 598 599 END SUBROUTINE get_input_file_list 600 601 602 !------------------------------------------------------------------------------! 603 ! Description: 604 ! ------------ 605 !> Abort INIFOR if the given file is not present. 606 !------------------------------------------------------------------------------! 607 SUBROUTINE verify_file(file_name, file_kind, tip) 608 609 CHARACTER(LEN=*), INTENT(IN) :: file_name, file_kind 610 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: tip 611 612 IF (.NOT. file_present(file_name)) THEN 613 614 IF (LEN(TRIM(file_name)) == 0) THEN 615 616 message = "No name was given for the " // TRIM(file_kind) // " file." 617 618 ELSE 619 620 message = "The " // TRIM(file_kind) // " file '" // & 621 TRIM(file_name) // "' was not found." 622 623 IF (PRESENT(tip)) THEN 624 message = TRIM(message) // " " // TRIM(tip) 625 END IF 626 627 END IF 628 629 CALL inifor_abort('verify_file', message) 630 631 END IF 632 633 END SUBROUTINE verify_file 634 635 531 636 !------------------------------------------------------------------------------! 532 637 ! Description: … … 552 657 SUBROUTINE validate_config(cfg) 553 658 TYPE(inifor_config), INTENT(IN) :: cfg 554 LOGICAL :: all_files_present 555 556 all_files_present = .TRUE. 557 all_files_present = all_files_present .AND. file_present(cfg % hhl_file, 'HHL') 558 all_files_present = all_files_present .AND. file_present(cfg % namelist_file, 'NAMELIST') 559 all_files_present = all_files_present .AND. file_present(cfg % soiltyp_file, 'SOILTYP') 659 660 CALL verify_file(cfg % hhl_file, 'HHL') 661 CALL verify_file(cfg % namelist_file, 'NAMELIST') 662 CALL verify_file(cfg % soiltyp_file, 'SOILTYP') 560 663 561 664 ! 562 665 !-- Only check optional static driver file name, if it has been given. 563 666 IF (TRIM(cfg % static_driver_file) .NE. '') THEN 564 all_files_present = all_files_present .AND. file_present(cfg % static_driver_file, 'static driver')667 CALL verify_file(cfg % static_driver_file, 'static driver') 565 668 END IF 566 669 567 IF (.NOT. all_files_present) THEN568 message = "INIFOR configuration invalid; some input files are missing."569 CALL inifor_abort( 'validate_config', message )570 END IF571 572 573 670 SELECT CASE( TRIM(cfg % ic_mode) ) 574 671 CASE( 'profile', 'volume') … … 619 716 !> Check whether the given file is present on the filesystem. 620 717 !------------------------------------------------------------------------------! 621 LOGICAL FUNCTION file_present(filename , kind)718 LOGICAL FUNCTION file_present(filename) 622 719 CHARACTER(LEN=PATH), INTENT(IN) :: filename 623 CHARACTER(LEN=*), INTENT(IN) :: kind 624 625 IF (LEN(TRIM(filename))==0) THEN 626 627 file_present = .FALSE. 628 message = "No name was given for the " // TRIM(kind) // " file." 629 CALL report('file_present', message) 630 631 ELSE 632 633 INQUIRE(FILE=filename, EXIST=file_present) 634 635 IF (.NOT. file_present) THEN 636 message = "The given " // TRIM(kind) // " file '" // & 637 TRIM(filename) // "' does not exist." 638 CALL report('file_present', message) 639 END IF 640 641 END IF 720 721 INQUIRE(FILE=filename, EXIST=file_present) 642 722 643 723 END FUNCTION file_present -
palm/trunk/UTIL/inifor/src/inifor_transform.f90
r3618 r3678 26 26 ! ----------------- 27 27 ! $Id$ 28 ! Check if set of averaging columns is empty 29 ! 30 ! 31 ! 3618 2018-12-10 13:25:22Z eckhard 28 32 ! Prefixed all INIFOR modules with inifor_, removed unused variables 29 33 ! … … 226 230 REAL(dp) :: ni 227 231 228 IF (SIZE(ii) .NE.SIZE(jj)) THEN232 IF (SIZE(ii) /= SIZE(jj)) THEN 229 233 message = "Length of 'ii' and 'jj' index lists do not match." // & 230 234 NEW_LINE(' ') // "ii has " // str(SIZE(ii)) // " elements, " // & 231 235 NEW_LINE(' ') // "jj has " // str(SIZE(jj)) // "." 236 CALL inifor_abort('average_2d', message) 237 END IF 238 239 IF (SIZE(ii) == 0) THEN 240 message = "No columns to average over; " // & 241 "size of index lists 'ii' and 'jj' is zero." 232 242 CALL inifor_abort('average_2d', message) 233 243 END IF -
palm/trunk/UTIL/inifor/tests/test-input-files.f90
r3618 r3678 21 21 ! Current revisions: 22 22 ! ----------------- 23 ! Switched to get_datetime_file_list() 23 24 ! 24 25 ! … … 51 52 USE inifor_defs, & 52 53 ONLY : PATH 53 USE inifor_ grid,&54 ONLY : get_ input_file_list54 USE inifor_io, & 55 ONLY : get_datetime_file_list 55 56 USE test_utils 56 57 … … 78 79 79 80 ! Act 80 CALL get_ input_file_list(start_date_string='2017102823',&81 start_hour=0, end_hour=5, step_hour=1,&82 path='./', prefix="laf", suffix='-test',&83 file_list=file_list)81 CALL get_datetime_file_list(start_date_string='2017102823', & 82 start_hour=0, end_hour=5, step_hour=1, & 83 input_path='./', prefix="laf", suffix='-test', & 84 file_list=file_list) 84 85 85 86 ! Assert … … 103 104 104 105 ! Act 105 CALL get_ input_file_list(start_date_string='2016022823',&106 start_hour=0, end_hour=1, step_hour=1,&107 path='./', prefix="laf", suffix='-test',&108 file_list=file_list)106 CALL get_datetime_file_list(start_date_string='2016022823', & 107 start_hour=0, end_hour=1, step_hour=1, & 108 input_path='./', prefix="laf", suffix='-test', & 109 file_list=file_list) 109 110 110 111 ! Assert … … 131 132 132 133 ! Act 133 CALL get_ input_file_list(start_date_string='2017102901',&134 start_hour=-2, end_hour=3, step_hour=2,&135 path='./', prefix="laf", suffix='-test',&136 file_list=file_list)134 CALL get_datetime_file_list(start_date_string='2017102901', & 135 start_hour=-2, end_hour=3, step_hour=2, & 136 input_path='./', prefix="laf", suffix='-test', & 137 file_list=file_list) 137 138 138 139 PRINT *, file_list
Note: See TracChangeset
for help on using the changeset viewer.