Skip to content

Commit

Permalink
Merge pull request #859 from chogrefe/hr2day_updates_cmaqv54
Browse files Browse the repository at this point in the history
Hr2day updates cmaqv54
  • Loading branch information
mathurrohit authored Mar 21, 2022
2 parents 16f9591 + 8373269 commit 3fbf66d
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 31 deletions.
2 changes: 1 addition & 1 deletion POST/hr2day/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Defines the name, units, expression and daily operation for each variable in OUT
@MAXT - uses the hourly value at maximum temperature
MAXDIF - uses the maximum hourly change
8HRMAX - uses the maximum 8 hour period
W126 - computes the secondary ozone standard, weighted average between 8am & 7pm
W126 - computes the W126 daily index value as a weighted average of ozone concentrations between 8am & 7pm. These daily index values can then be used to calculate annual W126 values for the secondary ozone standard by first computing 3-month sums of daily W126 index values and then determining the consecutive three month period with the largest 3-month sum of daily W126 values.
@8HRMAXO3 - averages the value within the 8-hr-max ozone period
HR@8HRMAX - Starting hour of the 8-hr-max period
SUM06 - computes the SUM06 ozone value
Expand Down
3 changes: 2 additions & 1 deletion POST/hr2day/scripts/run_hr2day.csh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
# setenv HOURS_8HRMAX 17

#> define species (format: "Name, units, From_species, Operation")
#> operations : {SUM, AVG, MIN, MAX, @MAXT, MAXDIF, 8HRMAX, SUM06}
#> operations : {SUM, AVG, MIN, MAX, HR@MIN, HR@MAX, @MAXT, MAXDIF,
#> 8HRMAX, W126, @8HRMAXO3, HR@8HRMAX, SUM06}
setenv SPECIES_1 "O3,ppbV,O3,8HRMAX"

#> Optional desired first and last processing date. The program will
Expand Down
6 changes: 3 additions & 3 deletions POST/hr2day/src/getTZ.F
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ Integer Function getTZ(longitude, latitude) result(tzoffset)
do i=1,SIZE(count)
if(lines(nlines)%npts.le.sizes(i)) then
count(i) = count(i) + 1
pts(i)%x(:,count(i)) = lon(1:lines(nlines)%npts)
pts(i)%y(:,count(i)) = lat(1:lines(nlines)%npts)
pts(i)%x(1:lines(nlines)%npts,count(i)) = lon(1:lines(nlines)%npts)
pts(i)%y(1:lines(nlines)%npts,count(i)) = lat(1:lines(nlines)%npts)
lines(nlines)%x => pts(i)%x(:,count(i))
lines(nlines)%y => pts(i)%y(:,count(i))
EXIT
Expand Down Expand Up @@ -397,7 +397,7 @@ Logical Function inArea( x, nval, values) result(result)
Real values(*)

! local variables
Real nsort
Integer nsort
Integer i
logical sorted
Real temp
Expand Down
29 changes: 17 additions & 12 deletions POST/hr2day/src/hr2day.F
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
! General Public License or the GNU Lesser General Public License is !
! subject to their copyright restrictions. !
!------------------------------------------------------------------------!

PROGRAM HR2DAY
C****************************************************************************************
C Converts hourly data values to daily
C
Expand All @@ -32,7 +32,8 @@
C @maxT - uses the hourly value at maximum temperature
C maxdif - uses the maximum hourly change
C 8hrmax - uses the maximum 8 hour period
C w126 - uses secondary standard ozone calculation
C w126 - calculates daily w126 index values for use in secondary
C ozone standard calculations
C @8hrmaxO3 - averages the value within the 8-hr-max ozone period
C hr@8hrmax - Starting hour of the 8-hr-max period
C sum06 - sums all values>=0.06ppm between 8am & 8pm
Expand Down Expand Up @@ -284,7 +285,7 @@
endif

if( SPECVARS(n)%OPERATION .eq. 'W126' ) then
Call w126(hrValues, dayValues, offset, SPECVARS(n)%UNITS)
Call w126_daily(hrValues, dayValues, offset, SPECVARS(n)%UNITS)
endif

if( SPECVARS(n)%OPERATION .eq. '@8HRMAXO3' ) then
Expand Down Expand Up @@ -320,9 +321,9 @@
enddo ! var loop
status = SHUT3 ()
rstatus = SHUT3 ()
stop
end
END Program HR2DAY
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
Expand Down Expand Up @@ -902,7 +903,7 @@ Subroutine max8hr(hrValues, dayValues, tzoffset)
C... Get the HOURS_8HRMAX environment variable (default is 24)
c ENV_DESC = 'Number of 8hr values to use when computing DM8HR'
c HOURS_8HRMAX= ENVINT( 'HOURS_8HRMAX', ENV_DESC, 24, STATUS)
c if ( ( HOURS_8HRMAX .NE. 24) .AND. ( HOURS_8HRMAX .NE. 17) ) THEN
c MSG = '**Error** Invalid value for HOURS_8HRMAX, use 24 or 17'
Expand Down Expand Up @@ -996,7 +997,7 @@ Subroutine max8hrHour(hrValues, dayValues, tzoffset)
C... Get the HOURS_8HRMAX environment variable (default is 24)
c ENV_DESC = 'Number of 8hr values to use when computing DM8HR'
c HOURS_8HRMAX= ENVINT( 'HOURS_8HRMAX', ENV_DESC, 24, STATUS)
c if ( ( HOURS_8HRMAX .NE. 24) .AND. ( HOURS_8HRMAX .NE. 17) ) THEN
c MSG = '**Error** Invalid value for HOURS_8HRMAX, use 24 or 17'
Expand Down Expand Up @@ -1069,11 +1070,15 @@ end Subroutine max8hrHour
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c Routine to compute to W126 values, sums the weighted concentrations in ppm
c between 8am & 8pm at each cell
c Routine to compute to daily W126 values, sums the weighted concentrations
c in ppm between 8am & 8pm at each cell
c These daily W126 index values can then be used in subsequent calculations
c for the secondary ozone standard by summing the daily index values over
c consecutive 3 month periods and determining the maximum of these 3 months
c sums.
c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
Subroutine w126(hrValues, dayValues, tzoffset, units)
Subroutine w126_daily(hrValues, dayValues, tzoffset, units)
USE M3UTILIO
USE ENV_VARS
Expand Down Expand Up @@ -1105,7 +1110,7 @@ Subroutine w126(hrValues, dayValues, tzoffset, units)
if( hrValues(h,c,r) .ge. 0.0 ) then
count = count+1
ozone = factor * hrValues(h,c,r)
sum = sum + ozone / (1.0 + 4403.0 * EXP( -126*ozone ))
sum = sum + ozone / (1.0 + 4403.0 * EXP( -126.0 * ozone ))
endif
endDo ! end hour loop
Expand All @@ -1116,7 +1121,7 @@ Subroutine w126(hrValues, dayValues, tzoffset, units)
endDo ! end row loop
return
end Subroutine w126
end Subroutine w126_daily
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
Expand Down
4 changes: 2 additions & 2 deletions POST/hr2day/src/module_envvar.F
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ SUBROUTINE GET_ENVS
C
C*************************************************************************
USE M3UTILIO
USE TIME_STEP
USE TIME_STEP

IMPLICIT NONE

Expand Down Expand Up @@ -110,7 +110,7 @@ SUBROUTINE GET_ENVS
C... Get the HOURS_8HRMAX environment variable (default is 24)
HOURS_8HRMAX = ENVINT( 'HOURS_8HRMAX',
& 'Number of 8hr values to use when computing DM8HR', 24, STATUS)

if ( ( HOURS_8HRMAX .NE. 24) .AND. ( HOURS_8HRMAX .NE. 17) ) THEN

MSG = '**Error** Invalid value for HOURS_8HRMAX, use 24 or 17'
Expand Down
24 changes: 12 additions & 12 deletions POST/hr2day/src/module_file.F
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,18 @@ SUBROUTINE OPEN_M3FILES
N_M3FILES = N_M3FILES + 1
M3_FLNAME( N_M3FILES ) = FL_NAME
ELSE
IF ( N_M3FILES .eq. 0) THEN !TRY CHECKING FOR 'INFILE' INSTEAD - BACKWARD COMPATIBILITY
ENV_DFLT = ' '
CALL ENVSTR( 'INFILE', ENV_DESC, ENV_DFLT, RET_VAL, STATUS)
IF( STATUS .EQ. 0 ) THEN
N_M3FILES = N_M3FILES + 1
M3_FLNAME( N_M3FILES ) = 'INFILE'
ELSE
EXIT
ENDIF
ELSE !NOT FIRST FILE, EXIT LOOP
EXIT
ENDIF
IF ( N_M3FILES .eq. 0) THEN !TRY CHECKING FOR 'INFILE' INSTEAD - BACKWARD COMPATIBILITY
ENV_DFLT = ' '
CALL ENVSTR( 'INFILE', ENV_DESC, ENV_DFLT, RET_VAL, STATUS)
IF( STATUS .EQ. 0 ) THEN
N_M3FILES = N_M3FILES + 1
M3_FLNAME( N_M3FILES ) = 'INFILE'
ELSE
EXIT
ENDIF
ELSE !NOT FIRST FILE, EXIT LOOP
EXIT
ENDIF
ENDIF

ENDDO
Expand Down

0 comments on commit 3fbf66d

Please sign in to comment.