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

Netcdf parallel output inconsistencies with WW3 binary output #1366

Open
kestonsmith-noaa opened this issue Feb 7, 2025 · 1 comment
Open
Labels
bug Something isn't working

Comments

@kestonsmith-noaa
Copy link

Describe the bug
In the direct netcdf output the partitioned mean wave direction fields, PDIR, produces some numeric values where binary WW3 outputs not a number (NaN) values. This is the case across all partitions. Where binary WW3 output has numeric values they are equivalent to the values from the netcdf parallel output.

To Reproduce
Jessica Meixner has a test case that demonstrates the error at: https://github.com/jessicameixner-noaa/ufs-weather-model

Expected behavior
Running ww3_ounf on binary WW3 output should produce identical output to the netcdf parallel output, with
PDIR(:,:,1) identical to pdir0(:), PDIR(:,:,2) identical to pdir1(:), etc.

Screenshots
None as of now

Additional context
The discrepancies in mean direction partition fields are due to a transformation from radians to degrees which does not check for NaN’s at application of the modulus function. The discrepancy can be resolved with a small change to subroutine write_var3d. Lines 613-615 of wav_history_mod.F90 (within subroutine write_var3d)

     if (mapsta(mapsf(isea,2),mapsf(isea,1)) > 0 )  then ! existing code
      varloc(:) = mod(630. - rade*varloc(:), 360.)
    end if

needs to account for NaN's in varloc (the mod function maps NaN's onto bogus numeric values). So lines 613+ ... should be:

     if (mapsta(mapsf(isea,2),mapsf(isea,1)) > 0 )  then ! recommended change
      do k = 1, size(varloc,1)
       if (varloc(k) .ne. undef)  varloc(k) = mod(630. - rade*varloc(k), 360.)
      end do
    end if

This issue may be compiler or flag dependent (we used the intel fortran compiler in our test). Jessica Meixner and I are going to continue to check other fields written directly to netcdf for inconsistencies with the binary WW3 output.

@kestonsmith-noaa kestonsmith-noaa added the bug Something isn't working label Feb 7, 2025
@kestonsmith-noaa
Copy link
Author

I should have put the term "PIO" in the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant