WRF icon indicating copy to clipboard operation
WRF copied to clipboard

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

Open tlspero opened this issue 9 months ago • 8 comments

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 avatar May 10 '24 14:05 tlspero

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 avatar Jun 13 '24 16:06 tlspero

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

tlspero avatar Jun 13 '24 20:06 tlspero

@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.

weiwangncar avatar Jun 13 '24 21:06 weiwangncar

@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.

tlspero avatar Jun 13 '24 21:06 tlspero

@tlspero Thanks! Next week would be fine.

weiwangncar avatar Jun 13 '24 21:06 weiwangncar

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

weiwangncar avatar Jun 13 '24 22:06 weiwangncar

@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.)

tlspero avatar Jun 20 '24 14:06 tlspero

@tlspero Thanks..

weiwangncar avatar Jun 20 '24 19:06 weiwangncar

@dudhia @islas If we cannot really define logical in global attributes, should we add lbuf and let the code turn it to integer, or should we use integer directly?

weiwangncar avatar Aug 06 '24 10:08 weiwangncar

@weiwangncar I think leaving as logical is fine. Switching to integer opens up to multiple interpretations and various values on fields that are otherwise only one of two options.

I think if there's an appropriate location we should just note that there is an assumption in what true and false correspond to as integers. The 1/0 to true/false interpretation is widely used but it's best to be explicit about any assumption/interpretations made.

islas avatar Aug 06 '24 19:08 islas

@dudhia Can you review this PR? Thanks!

weiwangncar avatar Aug 20 '24 05:08 weiwangncar

I had the question about how 'switch' is used with GT, but I looked at it and it seems OK.

dudhia avatar Aug 20 '24 11:08 dudhia