Changeset 4227 for palm/trunk/SOURCE/netcdf_interface_mod.f90
- Timestamp:
- Sep 10, 2019 6:04:34 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/netcdf_interface_mod.f90
r4196 r4227 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Replace function date_time_string by call to get_date_time 28 ! 29 ! 4223 2019-09-10 09:20:47Z gronemeier 27 30 ! replaced rotation angle from input-netCDF file 28 31 ! by namelist parameter 'rotation_angle' … … 6869 6872 ONLY: revision, run_date, run_time, run_zone, runnr, version 6870 6873 6871 USE date_and_time_mod, &6872 ONLY: day_of_year_init, time_utc_init6873 6874 6874 USE netcdf_data_input_mod, & 6875 6875 ONLY: input_file_atts 6876 6876 6877 USE palm_date_time_mod, & 6878 ONLY: date_time_str_len, get_date_time 6879 6877 6880 IMPLICIT NONE 6878 6881 6879 CHARACTER(LEN= 23) :: origin_time_string !< string containing date andtime of origin6882 CHARACTER(LEN=date_time_str_len) :: origin_time_string !< string containing date-time of origin 6880 6883 6881 6884 CHARACTER(LEN=*), INTENT(IN) :: data_content !< describes the type of data in file … … 6885 6888 INTEGER, INTENT(IN) :: ncid !< file id 6886 6889 ! 6887 !-- Composedate-time string for origin_time6888 origin_time_string = date_time_string( day_of_year_init, time_utc_init)6890 !-- Get date-time string for origin_time 6891 CALL get_date_time( 0.0_wp, date_time_str=origin_time_string ) 6889 6892 6890 6893 #if defined( __netcdf ) … … 7242 7245 END SUBROUTINE convert_utm_to_geographic 7243 7246 7244 !------------------------------------------------------------------------------!7245 ! Description:7246 ! ------------7247 !> Compose string containing date and time of format 'YYYY-MM-DD hh:mm:ss ZZZ'7248 !> from day_of_year and second_of_day.7249 !------------------------------------------------------------------------------!7250 FUNCTION date_time_string( day_of_year, second_of_day )7251 7252 IMPLICIT NONE7253 7254 CHARACTER(LEN=1) :: plus_minus !< either '+' or '-'7255 7256 CHARACTER(LEN=23) :: date_time_string !< string containing date and time7257 7258 INTEGER(iwp) :: day !< day of month7259 INTEGER(iwp) :: err !< error code7260 INTEGER(iwp) :: i !< loop index7261 INTEGER(iwp) :: hour !< hour of the day7262 INTEGER(iwp) :: minute !< minute of the hour7263 INTEGER(iwp) :: month !< month of year7264 INTEGER(iwp) :: year = 2019 !< year (no leap year)7265 INTEGER(iwp) :: zone = 0 !< time zone7266 7267 INTEGER(iwp), INTENT(IN) :: day_of_year !< day of year to start with7268 7269 INTEGER, DIMENSION(12) :: days_per_month = & !< total number of days for7270 (/31,28,31,30,31,30,31,31,30,31,30,31/) !< each month (no leap year)7271 7272 REAL(wp) :: second !< second of the minute7273 7274 REAL(wp), INTENT(IN) :: second_of_day !< second of the day7275 7276 7277 err = 0_iwp7278 !7279 !-- Check day_of_year7280 IF ( day_of_year < 1_iwp .OR. day_of_year > SUM(days_per_month) ) THEN7281 err = err + 1_iwp7282 ENDIF7283 !7284 !-- Check second_of_day7285 IF ( second_of_day < 0.0_wp .OR. second_of_day > 86400.0_wp ) THEN7286 err = err + 2_iwp7287 ENDIF7288 !7289 !-- Execute only if given values are valid7290 IF ( err == 0_iwp ) THEN7291 7292 day = day_of_year7293 month = 0_iwp7294 7295 DO i = 1, 127296 day = day - days_per_month(i)7297 IF ( day < 0 ) THEN7298 day = day + days_per_month(i)7299 month = i7300 EXIT7301 ENDIF7302 ENDDO7303 7304 hour = INT( second_of_day / 3600.0_wp, KIND=iwp )7305 7306 second = second_of_day - 3600.0_wp * REAL( hour, KIND=wp )7307 7308 minute = INT( second / 60.0_wp, KIND=iwp )7309 7310 second = second - 60.0_wp * REAL( minute, KIND=wp )7311 7312 IF ( zone < 0_iwp ) THEN7313 plus_minus = '-'7314 ELSE7315 plus_minus = '+'7316 ENDIF7317 7318 WRITE( date_time_string, 100 ) &7319 year, month, day, hour, minute, INT( second, KIND=iwp ), &7320 plus_minus, zone7321 7322 ELSE7323 !7324 !-- Return empty string if input is invalid7325 date_time_string = REPEAT( " ", LEN(date_time_string) )7326 7327 ENDIF7328 7329 100 FORMAT (I4,'-',I2.2,'-',I2.2,1X,I2.2,':',I2.2,':',I2.2,1X,A1,I2.2)7330 7331 END FUNCTION date_time_string7332 7333 7247 END MODULE netcdf_interface
Note: See TracChangeset
for help on using the changeset viewer.