Start by using the WRF/share/wrf_timeseries.F file as a reference. You can simply fill in one of the existing arrays for time series output (e.g., tslb) with your own information. All model data are available in that routine. If you would like to add one, you will need to modify Registry.EM_COMMON, and then make more changes in wrf_timeseries.F. Examples for adding a 2D variable or a 3D variable are listed below.
Adding a 2D Variable
For example, if you wanted to add ALBEDO and SWDOWN to WRFV4.1.3 timeseries output:
(1) Revise share/wrf_timeseries.F:
- Line 42 should be changed from:
to
- Line 44 should be changed from:
to something like (you can choose your suffixes:
-after line 482, add (in the #if EM_CORE block):
-after new line 580, add (in the #if EM_CORE block):
-after new line 751, add (in the #if EM_CORE block):
-after new line 914, add (in the #if EM_CORE block, write-statement):
Remember that the writes should be added in the #if(EM_CORE==1) block, after line 646. You will also need to change the format statement from
to
.
(2) Revise Registry/Registry.EM_COMMON:
-after line 732, add:
After making these changes, it's mandatory to go back to your WRF directory and issue a "./clean -a," then reconfigure and recompile, in order to see the changes in the output.
Adding a 3D Variable
For example, if you wanted to add base state pressure (PB) to WRFV4.1.3 timeseries output:
(1) Revise share/wrf_timeseries.F:
- Line 36 should be changed from:
to
- Line 38 should be changed from:
to something like (you can choose your suffixes:
-after line 438, add (in the #if EM_CORE block):
-after new line 471, add (in the #if EM_CORE block):
-after new line 573, add (in the #if EM_CORE block):
-after new line 813, add (in the #if block, write-statement):
(2) Revise Registry/Registry.EM_COMMON:
-after line 741, add:
After making these changes, it's mandatory to go back to your WRF directory and issue a "./clean -a," then reconfigure and recompile, in order to see the changes in the output.
Adding a 2D Variable
For example, if you wanted to add ALBEDO and SWDOWN to WRFV4.1.3 timeseries output:
(1) Revise share/wrf_timeseries.F:
- Line 42 should be changed from:
Code:
INTEGER, PARAMETER :: TS_FIELDS = 7
Code:
INTEGER, PARAMETER :: TS_FIELDS = 9
- Line 44 should be changed from:
Code:
ts_file_endings = (/ 'UU', 'VV', 'PH', 'TH', 'QV', 'WW', 'PR' /)
Code:
ts_file_endings = (/ 'UU', 'VV', 'PH', 'TH', 'QV', 'WW', 'PR', 'AL', 'SW' /)
-after line 482, add (in the #if EM_CORE block):
Code:
grid%ts_albedo(n,i)=grid%albedo(ix,iy)
grid%ts_swdown(n,i)=grid%swdown(ix,iy)
-after new line 580, add (in the #if EM_CORE block):
Code:
grid%ts_albedo(n,i) = 1.E30
grid%ts_swdown(n,i) = 1.E30
-after new line 751, add (in the #if EM_CORE block):
Code:
ts_buf( : , : )=grid%ts_swdown( : , : )
CALL wrf_dm_min_reals(ts_buf( : , : ),grid%ts_swdown( : , : ),grid%ts_buf_size*grid%max_ts_locs)
ts_buf( : , : )=grid%ts_albedo( : , : )
CALL wrf_dm_min_reals(ts_buf( : , : ),grid%ts_albedo( : , : ),grid%ts_buf_size*grid%max_ts_locs)
-after new line 914, add (in the #if EM_CORE block, write-statement):
Code:
...,&
grid%ts_albedo(n,i) &
grid%ts_swdown(n,i)
Remember that the writes should be added in the #if(EM_CORE==1) block, after line 646. You will also need to change the format statement from
Code:
14(f13.5,1x)
Code:
16(f13.5,1x)
(2) Revise Registry/Registry.EM_COMMON:
-after line 732, add:
Code:
state real ts_albedo ?! misc - - - "TS_ALBEDO" "Albedo"
state real ts_swdown ?! misc - - - "TS_SWDOWN" "shortwave down"
After making these changes, it's mandatory to go back to your WRF directory and issue a "./clean -a," then reconfigure and recompile, in order to see the changes in the output.
Adding a 3D Variable
For example, if you wanted to add base state pressure (PB) to WRFV4.1.3 timeseries output:
(1) Revise share/wrf_timeseries.F:
- Line 36 should be changed from:
Code:
INTEGER, PARAMETER :: TS_FIELDS = 7
Code:
INTEGER, PARAMETER :: TS_FIELDS = 8
- Line 38 should be changed from:
Code:
ts_file_endings = (/ 'UU', 'VV', 'PH', 'TH', 'QV', 'WW', 'PR' /)
Code:
ts_file_endings = (/ 'UU', 'VV', 'PH', 'TH', 'QV', 'WW', 'PR', 'PB' /)
-after line 438, add (in the #if EM_CORE block):
Code:
grid%ts_pb_profile(n,i,k)=grid%pb(ix,k,iy)
-after new line 471, add (in the #if EM_CORE block):
Code:
grid%ts_pb_profile(n,i,k) = 1.E30
-after new line 573, add (in the #if EM_CORE block):
Code:
DO k=1,grid%max_ts_level
ts_buf( : , : )=grid%ts_pb_profile( : , : , k )
CALL wrf_dm_min_reals(ts_buf( : , : ),grid%ts_pb_profile( : , : , k ),grid%ts_buf_size*grid%max_ts_locs)
END DO
-after new line 813, add (in the #if block, write-statement):
Code:
!Write pb profile to separate file
iunit = get_unused_unit()
IF ( iunit <= 0 ) THEN
CALL wrf_error_fatal('Error in write_ts: could not find a free Fortran unit.')
END IF
!Recreate filename for base state pressure profiles
k = LEN_TRIM(ts_profile_filename)
WRITE(ts_profile_filename(k-1:k), '(A2)') 'PB'
OPEN(UNIT=iunit, FILE=TRIM(ts_profile_filename), STATUS='unknown', POSITION='append', FORM='formatted')
DO n=1,grid%next_ts_time - 1
WRITE(UNIT=iunit,FMT=profile_format) &
grid%ts_hour(n,i), &
grid%ts_pb_profile(n,i,1:grid%max_ts_level)
END DO
CLOSE(UNIT=iunit)
(2) Revise Registry/Registry.EM_COMMON:
-after line 741, add:
Code:
state real ts_pb_profile ?!k misc - - - "TS_PB_PROFILE" "Base State Pressure"
After making these changes, it's mandatory to go back to your WRF directory and issue a "./clean -a," then reconfigure and recompile, in order to see the changes in the output.
Last edited: