wrf-model / WRF

The official repository for the Weather Research and Forecasting (WRF) model
Other
1.18k stars 658 forks source link

Updated global attributes for auxiliary output as well as runs with WRF-CMAQ #2044

Open tlspero opened 1 month ago

tlspero commented 1 month ago

Updates global attributes in auxiliary history files and separately for WRF-CMAQ

TYPE: bug fix

KEYWORDS: metadata, global attributes, auxiliary output, auxiliary history, WRF-CMAQ

SOURCE: Tanya Spero and Jeff Willison (U.S. EPA)

DESCRIPTION OF CHANGES: Problem: The suite of global attributes is incomplete in auxiliary history files. Notably, the precipitation tipping bucket is among the fields not included. Separately, there is no metadata in the header to indicate when WRF-CMAQ is used.

Solution: Changes are introduced in share/output_wrf.F to expand the use cases to write the full suite of global attributes to the metadata of auxiliary output files. In addition, two global attributes are added to the output only when the WRF-CMAQ model is invoked (WRF_CMAQ_OPTION and DIRECT_SW_FEEDBACK).

ISSUE: Fixes #1476

LIST OF MODIFIED FILES: share/output_wrf.F

TESTS CONDUCTED:

  1. Tests were conducted using the WRF model both with and without compiling with CMAQ. The base code was pulled from the branch "release-v4.6.0" on 8 May 2024. In both sets of tests on the EPA supercomputing system, an auxiliary output file was created in auxhist7. The global attributes were properly expanded to include the full suite of attributes in the auxiliary output file. The two new WRF-CMAQ coupled model attributes appeared when the WRF-CMAQ model was invoked.
  2. Did not conduct Jenkins testing.

RELEASE NOTE: Expanded global attributes to the full suite for auxiliary history files. Also added two global attributes when the WRF-CMAQ model is invoked (WRF_CMAQ_OPTION and DIRECT_SW_FEEDBACK).

tlspero commented 3 weeks ago

Hi @islas!

I submitted this PR with the intent of moving into WRFv4.6, but I did not realize that you were prepping for release at the time that I put this forth. This PR has been idle, other than you reassigned it to WRFv4.6.1 and some regression tests are allegedly still "running". Please let me know how you'd like me to proceed on this. There are no reviewers assigned, and I think someone at NCAR needs to intervene to make that happen. This PR addresses an Issue that I opened three years ago but did not complete with Dave Gill.

--Tanya

tlspero commented 3 weeks ago

Updated share/output_wrf.F to reflect comments from @weiwangncar.

weiwangncar commented 3 weeks ago

@tlspero Does adding lbuf allow logical values to write out to the global attributes? Can you show an example? The reason I'm asking is that writing a logical namelist variable had not been an option in the past. If what you did here adds that function, that would be very helpful. We could potentially add more to the global attributes.

tlspero commented 3 weeks ago

@weiwangncar --

We used the existing function, WRF_PUT_DOM_TI_LOGICAL, to add the logical variable to the global attributes. We had to create the local variable, LBUF, which we patterned after IBUF and RBUF. I believe the translation to the global attributes flipped the logical T/F to integer 1/0, but I would need to go back to recreate those output files to double-check. I think that we could continue using that function.

If you want me to recreate the output, I'll do that and add the output from "ncdump -h " here. It will be next week, though, due to schedule conflict this weekend.

weiwangncar commented 3 weeks ago

@tlspero Thanks! Next week would be fine.

weiwangncar commented 3 weeks ago

The regression test results:

Test Type              | Expected  | Received |  Failed
= = = = = = = = = = = = = = = = = = = = = = = =  = = = =
Number of Tests        : 23           24
Number of Builds       : 60           57
Number of Simulations  : 158           150        0
Number of Comparisons  : 95           86        0

Failed Simulations are: 
None
Which comparisons are not bit-for-bit: 
None
tlspero commented 2 weeks ago

@tlspero Does adding lbuf allow logical values to write out to the global attributes? Can you show an example? The reason I'm asking is that writing a logical namelist variable had not been an option in the past. If what you did here adds that function, that would be very helpful. We could potentially add more to the global attributes.

image

@weiwangncar, this screenshot from the global attributes shows using WRF_PUT_DOM_TI_LOGICAL to output a logical variable in this PR. The logical variables are indeed converted from T/F to 1/0, as shown with the value of DIRECT_SW_FEEDBACK as 0 in the global attributes for a setting of .FALSE. in the WRF-CMAQ run. (The run is courtesy of my colleague, Jeff Willison, who is the co-sponsor of this PR.)

weiwangncar commented 2 weeks ago

@tlspero Thanks..