Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to use NetCDF output instead of binary for point output #1230

Merged

Conversation

JessicaMeixner-NOAA
Copy link
Collaborator

Pull Request Summary

Add a switch BIN2NC which will write a NetCDF file instead of a binary file for point output.

Description

When using BIN2NC, the point output will now be written in NetCDF from ww3_shel or ww3_multi. The exes for output post-processing will be able to read these files. Some notes:

  • ww3_ounp is still necessary. While we can add at a future date direction and frequency so that programs such as ww3_bounc could use this without post-processing with ww3_ounf, there are many options and formats of variables that we likely do not want to be converting between in the model output. Therefore, at this time, we are not replacing ww3_ounp. There is room for future enhancement to reduce the need for ww3_ounp for some applications.
  • A switch was used instead of a namelist option because I suspect we will eventually remove binary, but in the meantime having a switch still allows those who wish to run without NetCDF that option. I thought this was the simplest approach, but it's certainly not the only possibility and could be another future place for improvement.

Co-authors are @edwardhartnett and @MatthewMasarik-NOAA

Please also include the following information:

  • Mention any labels that should be added new feature
  • Are answer changes expected from this PR? While the format of the output will change and regtests that have added this feature will change, the other files do not change.

Issue(s) addressed

Commit Message

Add option to use NetCDF output instead of binary for point output

Check list

Testing

  • How were these changes tested? With matrix. Additionally, I hard-coded the switch option to always be on and then ran all of the regression tests using the NetCDF option (see branch: https://github.com/JessicaMeixner-NOAA/WW3/tree/feature/pointbinary2nc_hardcoded). Output of this branch matrix comp is also shared below.
  • Are the changes covered by regression tests? (If not, why? Do new tests need to be added?) Yes, new tests were added.
  • Have the matrix regression tests been run (if yes, please note HPC and compiler)? Yes hera intel (on this branch, plus the hard-coded branch).
  • Please indicate the expected changes in the regression test output, (Note the list of known non-identical tests.)

New tests:
ww3 ww3_tp2.2/work_PR1_MPI_BIN2NC
And updates to ww3_ufs1.1 unstructured tests as they will now use this feature. Note the results do not chnage, just binary -> netcdf for the points, and the switch file in the netcdf output.

  • Please provide the summary output of matrix.comp (matrix.Diff.txt, matrixCompFull.txt and matrixCompSummary.txt):

I ran two sets of tests, one from this branch compared with develop:

**********************************************************************
********************* non-identical cases ****************************
**********************************************************************
mww3_test_03/./work_PR1_MPI_e                     (1 files differ)
mww3_test_03/./work_PR3_UQ_MPI_e_c                     (1 files differ)
mww3_test_03/./work_PR3_UNO_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UQ_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UNO_MPI_d2                     (16 files differ)
mww3_test_03/./work_PR1_MPI_d2                     (9 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2_c                     (11 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2_c                     (15 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2                     (15 files differ)
mww3_test_03/./work_PR2_UQ_MPI_d2                     (15 files differ)
mww3_test_03/./work_PR3_UQ_MPI_e                     (1 files differ)
mww3_test_03/./work_PR3_UNO_MPI_e_c                     (1 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2                     (16 files differ)
mww3_test_09/./work_MPI_ASCII                     (0 files differ)
ww3_tp2.10/./work_MPI_OMPH                     (7 files differ)
ww3_tp2.16/./work_MPI_OMPH                     (4 files differ)
ww3_tp2.2/./work_PR1_MPI_BIN2NC                     (directory not found)
ww3_tp2.6/./work_ST4_ASCII                     (0 files differ)
ww3_ufs1.1/./work_unstr_b                     (1 files differ)
ww3_ufs1.1/./work_unstr_a                     (1 files differ)
ww3_ufs1.1/./work_unstr_c                     (1 files differ)
ww3_ufs1.3/./work_a                     (3 files differ)

matrixCompFull.txt
matrixCompSummary.txt
matrixDiff.txt

And then I ran tests hard-coding the option to use BIN2NC by default (https://github.com/JessicaMeixner-NOAA/WW3/tree/feature/pointbinary2nc_hardcoded) to ensure all the various combinations were tested and ignoring "0 diffs" in the output the changes are as expected as well:

**********************************************************************
********************* non-identical cases ****************************
**********************************************************************
mww3_test_03/./work_PR1_MPI_e                     (1 files differ)
mww3_test_03/./work_PR3_UQ_MPI_e_c                     (1 files differ)
mww3_test_03/./work_PR3_UNO_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UQ_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UNO_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UNO_MPI_d2                     (13 files differ)
mww3_test_03/./work_PR1_MPI_d2                     (21 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2_c                     (13 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2_c                     (13 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2                     (13 files differ)
mww3_test_03/./work_PR2_UQ_MPI_d2                     (14 files differ)
mww3_test_03/./work_PR3_UQ_MPI_e                     (1 files differ)
mww3_test_03/./work_PR3_UNO_MPI_e_c                     (1 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2                     (13 files differ)
ww3_tp2.10/./work_MPI_OMPH                     (5 files differ)
ww3_tp2.16/./work_MPI_OMPH                     (3 files differ)
ww3_tp2.2/./work_PR1_MPI_BIN2NC                     (directory not found)
ww3_ufs1.1/./work_unstr_b                     (1 files differ)
ww3_ufs1.1/./work_unstr_a                     (1 files differ)
ww3_ufs1.1/./work_unstr_c                     (1 files differ)
ww3_ufs1.3/./work_a                     (3 files differ)
  • note the ww3_ufs1.1/./work_unstr_* cases are because the switch file changed in the NetCDF output.

matrixCompFull.txt
matrixCompSummary.txt
matrixDiff.txt

@mickaelaccensi
Copy link
Collaborator

I'm running the matrix. I'll keep you informed

@JessicaMeixner-NOAA
Copy link
Collaborator Author

@ukmo-ccbunney @mickaelaccensi - Please let me know if you are running into any issues with this that I might be able to help with debugging.

@mickaelaccensi
Copy link
Collaborator

matrix is done but I have both an error in develop and bin2nc branches for ww3_tp2.10 for output point processing due to the fact that the only requested output point (B45005) is considered on land. It is a SMC grid test so it is not linked to this PR. @ukmo-ccbunney and @ukmo-jianguo-li can probably double check this problem.

I've checked at ww3_tp2.2 for the format of the out_pnt.ww3.nc, it would be great to have at least the time variable defined in the correct calendar format and standard instead of a 2d array of integers. I think using the functions in w3timemd.ftn it should not bet too complicated..

Anyway, I'm now running the matrix.comp. Once done I'll keep you informed.

@mickaelaccensi
Copy link
Collaborator

mww3_test_03/./work_PR2_UQ_MPI_d2                     (15 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2                     (12 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2_c                     (15 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2_c                     (14 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2                     (15 files differ)
mww3_test_03/./work_PR1_MPI_d2                     (14 files differ)
mww3_test_03/./work_PR3_UQ_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UNO_MPI_d2                     (15 files differ)
ww3_tp2.10/./work_MPI                     (1 files differ)
ww3_tp2.17/./work_mc1                     (6 files differ)
ww3_tp2.17/./work_mc                     (5 files differ)
ww3_tp2.17/./work_c                     (8 files differ)
ww3_tp2.17/./work_b                     (4 files differ)
ww3_tp2.17/./work_mb                     (3 files differ)
ww3_tp2.2/./work_PR1_MPI_BIN2NC                     (directory not found)
ww3_tp2.21/./work_b                     (6 files differ)
ww3_tp2.21/./work_mb                     (7 files differ)
ww3_tp2.6/./work_pdlib                     (14 files differ)

differences sound ok. tp2.17, ww2.21 and ww3_tp2.6 are due to pdlib not b4b

Except the format of time variable in out_pnt.ww3.nc, I'm ok with this PR

@ukmo-jianguo-li
Copy link
Collaborator

ukmo-jianguo-li commented May 31, 2024 via email

@mickaelaccensi
Copy link
Collaborator

thanks @ukmo-jianguo-li for the exclanation. I'll let you create an issue for this so.

@JessicaMeixner-NOAA
Copy link
Collaborator Author

Except the format of time variable in out_pnt.ww3.nc, I'm ok with this PR

@mickaelaccensi The time format is what WW3 is expecting to read in and then use in the next routines. I'm thinking we just add an additional time variable as you requested instead of changing this one, thoughts?

@ukmo-ccbunney
Copy link
Collaborator

thanks @ukmo-jianguo-li for the exclanation. I'll let you create an issue for this so.

Thanks Mickael - I'll raise an Issue for this.

@mickaelaccensi
Copy link
Collaborator

Except the format of time variable in out_pnt.ww3.nc, I'm ok with this PR

@mickaelaccensi The time format is what WW3 is expecting to read in and then use in the next routines. I'm thinking we just add an additional time variable as you requested instead of changing this one, thoughts?

It seems to be a solution. To do it, you would need to rename the current time variable as another name (like time_ww3) and create a new time variable with the calendar format. It would be great for future use the out_grd.ww3.nc

@JessicaMeixner-NOAA
Copy link
Collaborator Author

@mickaelaccensi and @ukmo-ccbunney I have added the extra time variable as @mickaelaccensi requested. Let me know what you think. @ukmo-ccbunney I think I have addressed your concerns of things not working, but I still see changes requested, so if I missed something or things are still not working for you please let me know!

@mickaelaccensi
Copy link
Collaborator

mickaelaccensi commented Jun 7, 2024

@JessicaMeixner-NOAA, thanks first to have added the TIME variable. There is just an issue in the TIME values. See screenshot

image

@JessicaMeixner-NOAA
Copy link
Collaborator Author

Okay i just went to debug this and check this out and i somehow deleted a few lines of code. Should have a fix here in an hour or so. Thanks for catching this @mickaelaccensi !

@JessicaMeixner-NOAA
Copy link
Collaborator Author

@mickaelaccensi time should be fixed now! Please let me know if you see issues still.

@mickaelaccensi
Copy link
Collaborator

I confirm the bugfix !

@JessicaMeixner-NOAA
Copy link
Collaborator Author

@ukmo-ccbunney - are things working for you on your end?

Copy link
Collaborator

@ukmo-ccbunney ukmo-ccbunney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regression test ww3_tp2.2/PR1_MPI_BIN2NC ran fine and output looks good.
Running full regtest matrix now for completeness.

@ukmo-ccbunney
Copy link
Collaborator

All regtests ran ok with just the usual differences in mww3_test_03. 👍

@JessicaMeixner-NOAA
Copy link
Collaborator Author

Thanks @ukmo-ccbunney!

@MatthewMasarik-NOAA - I think this is ready for your final review now!

@MatthewMasarik-NOAA
Copy link
Collaborator

Thanks @ukmo-ccbunney!

@MatthewMasarik-NOAA - I think this is ready for your final review now!

Great, thanks for confirming, I have the review in progress now.

Copy link
Collaborator

@MatthewMasarik-NOAA MatthewMasarik-NOAA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review
Pass

Testing
Pass

  • Compared with develop branch:
**********************************************************************
********************* non-identical cases ****************************
**********************************************************************
mww3_test_03/./work_PR1_MPI_e                     (1 files differ)
mww3_test_03/./work_PR3_UQ_MPI_e_c                     (1 files differ)
mww3_test_03/./work_PR3_UNO_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UQ_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UNO_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UNO_MPI_d2                     (17 files differ)
mww3_test_03/./work_PR1_MPI_d2                     (14 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2_c                     (13 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2_c                     (16 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2                     (15 files differ)
mww3_test_03/./work_PR2_UQ_MPI_d2                     (15 files differ)
mww3_test_03/./work_PR3_UNO_MPI_e_c                     (1 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2                     (15 files differ)
mww3_test_09/./work_MPI_ASCII                     (0 files differ)
ww3_tp2.10/./work_MPI_OMPH                     (7 files differ)
ww3_tp2.16/./work_MPI_OMPH                     (4 files differ)
ww3_tp2.6/./work_ST4_ASCII                     (0 files differ)
ww3_ufs1.1/./work_unstr_b                     (1 files differ)
ww3_ufs1.1/./work_unstr_a                     (1 files differ)
ww3_ufs1.1/./work_unstr_c                     (1 files differ)
ww3_ufs1.3/./work_a                     (1 files differ)
 
**********************************************************************
************************ identical cases *****************************
**********************************************************************

matrixCompFull.txt
matrixDiff.txt
matrixCompSummary.txt

  • Compared with feature/pointbinary2nc_hardcoded branch:

hardcoded.matrixCompFull.txt
hardcoded.matrixDiff.txt
hardcoded.matrixCompSummary.txt

Approved.

@MatthewMasarik-NOAA MatthewMasarik-NOAA merged commit 629d27a into NOAA-EMC:develop Jun 14, 2024
20 checks passed
@MatthewMasarik-NOAA
Copy link
Collaborator

A big thank you to @JessicaMeixner-NOAA, who took over the reins and saw this work to completion, and @edwardhartnett who initiated the work and laid the foundation. This is a great contribution in converting WW3 binary outputs to netcdf! Thanks also goes to @mickaelaccensi and @ukmo-ccbunney for testing, and giving feedback that improved the final PR.

ukmo-ccbunney added a commit to ukmo-waves/WW3 that referenced this pull request Sep 4, 2024
* feature/gpu/w3srce_refactor:
  Enable doxygen documentation in the cmake build system (NOAA-EMC#1281)
  Simplify MPI ifdefs in subroutine W3MPIO (NOAA-EMC#1266)
  Add depth scaling value to SMC regression tests. (NOAA-EMC#1264)
  Updates to NCEP regtests for Orion Rocky9 OS(NOAA-EMC#1263)
  Fix code stability issue in ww3_outp (NOAA-EMC#1258)
  Fix GNU regtest CI failure (NOAA-EMC#1253)
  Add option to use NetCDF output instead of binary for point output (NOAA-EMC#1230)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update subroutine W3IOPO to read/write NetCDF files (point output binary -> netcdf)
6 participants