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

Masking fix in cosp_diag_warmrain? #63

Closed
dustinswales opened this issue Mar 15, 2022 · 4 comments
Closed

Masking fix in cosp_diag_warmrain? #63

dustinswales opened this issue Mar 15, 2022 · 4 comments
Labels

Comments

@dustinswales
Copy link
Contributor

cosp_diag_warmrain relies on the MODIS LWP(IWP)'s to determine when to perform a retrieval, https://github.com/CFMIP/COSPv2.0/blob/master/src/cosp_stats.F90#L345

However, the MODIS LWP is set to R_UNDEF, -999, for non-sunlit points prior to this routine being called. In these cases, zeros are being assigned for some of the diagnostics, where they should be set to R_UNDEF and omitted for the statistics.

This came up in an unrelated PR from 2019 (#36).

@dustinswales
Copy link
Contributor Author

The wrinkle to this is cloud-free scenes and dark scenes are both set to R_UNDEF in the modis-simulator. We want to include to former, but not the latter.

@takmichibata
Copy link
Contributor

@dustinswales I apporogize for this bug and late reply. The warm rain diagnostics did intend to use only daytime cloudy scenes, but actually the current code did not explicitly exclude dark-scene columns from the analysis.
To fix this bug, I will change the following two places as suggested by @brhillman and @dustinswales at the previous PR from 2019 (#36).

https://github.com/CFMIP/COSPv2.0/blob/master/src/cosp_stats.F90#L338

!! initialize
 do i = 1, Npoints
    if ( lwp(i) .eq. R_UNDEF ) then  ! for non-sunlit columns
       cfodd_ntotal(i,:,:,:) = R_UNDEF
       wr_occfreq_ntotal(i,:) = R_UNDEF
       icod(i,:,:) = R_UNDEF
    else
       cfodd_ntotal(i,:,:,:)  = 0._wp
       wr_occfreq_ntotal(i,:) = 0._wp
       icod(i,:,:) = 0._wp
    endif
 enddo

https://github.com/CFMIP/COSPv2.0/blob/master/src/cosp_stats.F90#L345

    if ( ( lwp(i)   .le.  CWP_THRESHOLD  .and. lwp(i)  .ne.  R_UNDEF  ) .or.  &

I think this change will work appropriately for the issue. I push the bug-fix later via pull request.

@takmichibata
Copy link
Contributor

@dustinswales I think that we can now close this thread, as we have corrected this bug in the recent PR (#73). Thank you for your support.

@dustinswales
Copy link
Contributor Author

@takmichibata
Excellent!
Thanks for your work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants