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

ww3_prnc 360_day calendar support #1193

Merged
merged 8 commits into from
Mar 13, 2024

Conversation

ukmo-ccbunney
Copy link
Collaborator

@ukmo-ccbunney ukmo-ccbunney commented Feb 23, 2024

Pull Request Summary

Adds support to ww3_prnc for reading netCDF files with times using the "360_day" calendar.

Description

Currently, ww3_prnc only supports reading netCDF files with times relative to "standard" or "gregorian" calendars even though WW3 itself can run in a "360_day" calendar.

This update adds 360_day calendar support in the Julian day calculations in w3timemd via subroutines J2D and D2J.
The subroutines now return/receive a pseudo-Julian day as an offset from 1800-01-01 00:00:00 if CALTYPE .eq. '360_day'

I was in two minds whether to modify the J2D and D2J Julian day routines to handle this as technically the returned value is not related to a Julian day if using a 360_day calendar. It seemed like the most sensible place to make the calculation though with minimal changes elsewhere in the code. However, if preferred I can move these calculations to their own separate routine, e.g. D360_TO_DATE and DATE_TO_D360.

ww3_prnc will check that the "calendar attribute in the file matches the expected calendar in CALTYPE (set via the ww3_grid MISC namelist entry) and fail if they are not the same.

There are no changes expected in the existing regtests due to this update.

Issue(s) addressed

Commit Message

Adds 360_day calendar support to ww3_prnc

Check list

Testing

  • How were these changes tested? Local testing with 360 day netCDF input file and regtest matrix
  • Are the changes covered by regression tests? (If not, why? Do new tests need to be added?) No
  • Have the matrix regression tests been run (if yes, please note HPC and compiler)? Yes; Cray XC; GNU Fortran

Regtest results

Ignoring the usual known non-b4b regtests, the following tests had expected changes

**********************************************************************
********************* non-identical cases ****************************
**********************************************************************
ww3_tic1.4/./work_IC2IS2_IC2b                     (3 files differ)
ww3_tic1.4/./work_IC0IS2_1000                     (3 files differ)
ww3_tic1.4/./work_IC1IS2_1000                     (3 files differ)
ww3_tic1.4/./work_IC2IS2_IC2d                     (3 files differ)
ww3_tp2.14/./work_OASACM6                     (1 files differ)
ww3_tp2.15/./work_PR3_UQ_RHO                     (4 files differ)
ww3_tp2.15/./work_PR3_UQ_RHO_MPI                     (1 files differ)
ww3_tp2.15/./work_PR3_UQ                     (2 files differ)
ww3_tp2.15/./work_ST4FLX5                     (4 files differ)
ww3_tp2.15/./work_ST6FLX5                     (3 files differ)
ww3_tp2.15/./work_MPI_5km                     (2 files differ)
ww3_tp2.15/./work_5km                     (2 files differ)
ww3_tp2.15/./work_PR3_UQ_MPI                     (2 files differ)
ww3_tp2.17/./work_ma                     (1 files differ)
ww3_tp2.17/./work_a                     (1 files differ)
ww3_tp2.17/./work_ma1                     (directory not found)
ww3_tp2.8/./work_PR3_UQ                     (1 files differ)

The changes are all due to a small rewording of the warning message about unset calendar attribute:

<      DEFAULTING TO "standard" CALENDAR
<      INPUT FILE MUST RESPECT STANDARD/GREGORIAN CALENDAR
---
>      IT MUST RESPECT STANDARD OR GREGORIAN CALENDAR

@ukmo-ccbunney
Copy link
Collaborator Author

@mickaelaccensi I would appreciate your opinion on the changes to w3timemd with respect to the comments I made in the PR description (specifically the J2D and D2J subroutines. I'm happy to modify the code if you would prefer to have the 360_day calendar calculations as separate routines.

Copy link
Collaborator

@mickaelaccensi mickaelaccensi left a comment

Choose a reason for hiding this comment

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

I approve the changes, I've added a few comments

model/src/w3timemd.F90 Outdated Show resolved Hide resolved
model/src/w3timemd.F90 Outdated Show resolved Hide resolved
model/src/ww3_prnc.F90 Outdated Show resolved Hide resolved
@MatthewMasarik-NOAA
Copy link
Collaborator

Awesome, thanks @ukmo-ccbunney and @mickaelaccensi, I'll proceed with testing!

@MatthewMasarik-NOAA
Copy link
Collaborator

Good evening @ukmo-ccbunney, I wanted to let you know before it gets later that I'm processing your PR and I should be able to finish by our COB today. I had a few more test diffs than you found, but I suspect that's just due to our machine differences, and they seem to be all of the type you identified

<      DEFAULTING TO "standard" CALENDAR
<      INPUT FILE MUST RESPECT STANDARD/GREGORIAN CALENDAR
---
>      IT MUST RESPECT STANDARD OR GREGORIAN CALENDAR

within the ww3_prnc*.out files. I'm going to double check that's the case, and if so I can approve and merge today.

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

Known non-b4b's and new non-b4b's grouped below. The new non-b4b's can all be attributed to text in ww3_prnc*.out logs as pointed out in the PR header.

**********************************************************************
********************* non-identical cases ****************************
**********************************************************************
## known non-b4b's
## ---------------
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_UNO_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UNO_MPI_d2                     (16 files differ)
mww3_test_03/./work_PR1_MPI_d2                     (6 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2_c                     (9 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2_c                     (15 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2                     (11 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                     (14 files differ)
mww3_test_09/./work_MPI_ASCII                     (0 files differ)
ww3_tp2.6/./work_ST4_ASCII                     (0 files differ)
ww3_tp2.10/./work_MPI_OMPH                     (7 files differ)
ww3_tp2.16/./work_MPI_OMPH                     (4 files differ)


## new non-b4b's -- verfied all due to ww3_prnc*.out
## -------------------------------------------------
ww3_tic1.4/./work_IC1IS2_1000                     (3 files differ)
ww3_tic1.4/./work_IC2IS2_IC2d                     (3 files differ)
ww3_tic1.4/./work_IC2IS2_IC2b                     (3 files differ)
ww3_tic1.4/./work_IC0IS2_1000                     (3 files differ)
ww3_tp2.14/./work_OASACM6                     (1 files differ)
ww3_tp2.15/./work_PR3_UQ_RHO                     (3 files differ)
ww3_tp2.15/./work_5km                     (1 files differ)
ww3_tp2.15/./work_PR3_UQ_RHO_MPI                     (3 files differ)
ww3_tp2.15/./work_ST6FLX5                     (3 files differ)
ww3_tp2.15/./work_PR3_UQ                     (1 files differ)
ww3_tp2.15/./work_MPI_5km                     (1 files differ)
ww3_tp2.15/./work_PR3_UQ_MPI                     (1 files differ)
ww3_tp2.15/./work_ST4FLX5                     (3 files differ)
ww3_tp2.17/./work_ma                     (3 files differ)
ww3_tp2.17/./work_a                     (3 files differ)
ww3_tp2.17/./work_mc1                     (3 files differ)
ww3_tp2.17/./work_mb                     (3 files differ)
ww3_tp2.17/./work_mc                     (3 files differ)
ww3_tp2.17/./work_ma1                     (3 files differ)
ww3_tp2.17/./work_c                     (3 files differ)
ww3_tp2.17/./work_b                     (3 files differ)
ww3_tp2.8/./work_PR3_UQ                     (1 files differ)
ww3_ufs1.1/./work_unstr_b                     (3 files differ)
ww3_ufs1.1/./work_c_npl                     (3 files differ)
ww3_ufs1.1/./work_unstr_a                     (3 files differ)
ww3_ufs1.1/./work_unstr_c                     (3 files differ)
ww3_ufs1.1/./work_d                     (3 files differ)
ww3_ufs1.1/./work_c_nth                     (3 files differ)
ww3_ufs1.1/./work_c                     (3 files differ)
ww3_ufs1.2/./work_a                     (3 files differ)
ww3_ufs1.2/./work_l                     (3 files differ)
ww3_ufs1.2/./work_c                     (3 files differ)
ww3_ufs1.2/./work_b                     (3 files differ)
ww3_ufs1.3/./work_a                     (5 files differ)

**********************************************************************
************************ identical cases *****************************
**********************************************************************

Approved.

@MatthewMasarik-NOAA MatthewMasarik-NOAA merged commit e064dbf into NOAA-EMC:develop Mar 13, 2024
20 checks passed
@MatthewMasarik-NOAA
Copy link
Collaborator

Thank you @ukmo-ccbunney, for expanding WW3's calendar support to include "360_day".

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.

WW3_PRNC does not handle 360 day calendars
3 participants