Skip to content

Conversation

@jshaw35
Copy link
Contributor

@jshaw35 jshaw35 commented Sep 3, 2025

This PR contains significant additions to COSP that enable two new functionalities:

  • Coupling with the RTTOV radiative transfer model has been reestablished and expanded. COSP users may specify an arbitrary number of instruments supported by RTTOV and produce clear-sky and all-sky radiance and brightness temperature fields consistent with these instruments' spectral response function. For each instrument, any subset of spectral channels may be simulated.
  • New swathing routines allow users to specify a simplified satellite-like sampling routine. Sampling routines are parametrized by a list of equator crossing times (in local time) and swath widths (in km). These parameters define an evolving mask the describes which model grid cells are sampled by the instrument. Only these grid cells are passed into the individual instrument simulators while remaining grid cells are masked to avoid incorrect temporal averaging. These masking routines produce realistic sampling patterns that favor high-latitudes and allow for the isolation of day- or nighttime orbits without saving high-frequency model output. Computational cost is also reduced due to fewer simulator calls. This functionality can be specified separately for ISCCP, MISR, MODIS, PARASOL, ATLID, and CloudSat+CALIPSO outputs as well as for each RTTOV instrument.

For an exhaustive description of implementation, validation, and science applications, see our GMD paper (https://gmd.copernicus.org/articles/18/4935/2025/). @dustinswales has been an invaluable contributor to all aspects of this work.

Remaining items:

  • CI checks should be expanded to validate the swathing routine.
  • CI checks for RTTOV would be great, but would require an RTTOV installation.
  • Two variables: modis_optical_thickness_vs_ReffLIQ and modis_optical_thickness_vs_ReffICE are saved at all timesteps. These variables should probably be limited to sunlit timesteps only. Minor changes to address this issue can be found here, but require a further update to the KGOs: (dustinswales@a8e61ad)

jshaw35 and others added 30 commits January 30, 2023 10:01
Merge updates into working version (2023/01/30)
Merging with the main branch. Should not do again.
The RTTOV v13 code files are copies of cosp_rttov_interface.F90 and cosp_rttov11.F90

No changes made yet.
… added conditional dependencies in cosp2_test.F90 and cosp.F90
…efile has changed

cosp_rttov_interface_v13.F90 will not be compiled unless RTTOV is being built into COSP, so I no longer need #ifdef RTTOV statements in this file.
…it passes the RTTOV instrument, channel, etc information into the cosp_rttov_init call.
Shifted DDT in both the STUB and main files.
@jshaw35
Copy link
Contributor Author

jshaw35 commented Dec 3, 2025

I've just pulled in the most recent updates, but the standard (non-swathed) ifx tests are now failing. The differences are suspiciously similar to those introduced by the compiler changes here, which makes me think that the kgo tests did not fully update. However, I've checked that those changes have all been brought in correctly. It is possible that the new compiler has broken the bit-for-bit reproducibility with the new PR, but this seems unlikely to me.

Am I missing something obvious and do you have suggestions on how to troubleshoot? @dustinswales @RobertPincus @alejandrobodas

@alejandrobodas
Copy link
Collaborator

I've looked at the md5 hashes of the outputs of the failed test and they don't match the hashes of the v007 KGOs (or at previous versions). This suggests that there is something in this PR that does break bit-comparability for ifx.

@jshaw35
Copy link
Contributor Author

jshaw35 commented Dec 3, 2025

It appears that there are several things going on here.

  1. Some of the MODIS histogram outputs are not being handled appropriately in cosp.F90. Specifically, "modis_Optical_Thickness_vs_Cloud_Top_Pressure_Liq" and "modis_Optical_Thickness_vs_Cloud_Top_Pressure_Ice" are not masked out for non-sunlit gridcells/timesteps. I believe that they should be treated analogously to "modis_Optical_Thickness_vs_Cloud_Top_Pressure". Consistency should also be applied when "Lmodis_subcolumn" and "Lmodis_column" are determined. These phase specific tau-ctp histogram fields are missing from CI/CD output and testing, but I suspect they would be showing bad values if we were evaluating them. I'll leave this to a separate PR.
  2. The MODIS variables effected by the compiler change ("modis_Optical_Thickness_vs_ReffIce", "modis_Optical_Thickness_vs_ReffLiq") are also not being masked in non-sunlit regions. This is likely because the Reff histogram variables appear to use fill values of 0. This presents issues when averaging across multiple timesteps (since I assume an average should be conditioned on the retrieval occurring). I believe this is currently left to users to handle in the coupler (e.g. mask out zeros there), which why non sunlit columns were not being set to nans. I will set these variables to zero by default to remain consistent with this previous behavior and avoid the stale values that were resurfacing with the new compiler.

I suspect that the other variables that do not match kgos are experience similar issues. We'll see!

@RobertPincus
Copy link
Contributor

@jshaw35 Although I don't think this will solve the issue I note that particle size WRK arrays are not being masked for thin an clear columns in modis_column() (e.g. at line 401).

@jshaw35
Copy link
Contributor Author

jshaw35 commented Dec 12, 2025

@mo-abodas I have brought this PR in line with #143. It should only require v007 KGOs for the new swathed tests. We are so close!

@alejandrobodas
Copy link
Collaborator

@jshaw35 should I give it a try at uploading the swath outputs from the latest checks as KGOs?

@jshaw35
Copy link
Contributor Author

jshaw35 commented Dec 12, 2025

@jshaw35 should I give it a try at uploading the swath outputs from the latest checks as KGOs?

@alejandrobodas that would be great!

@alejandrobodas
Copy link
Collaborator

@jshaw35 the file attached contains the updated .out and .md5 files, and the KGOs URLs.
files.tar.zip

@jshaw35
Copy link
Contributor Author

jshaw35 commented Dec 14, 2025

@alejandrobodas all checks are passing! Now all I think this needs is a formal code review.

Copy link
Collaborator

@alejandrobodas alejandrobodas left a comment

Choose a reason for hiding this comment

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

@jshaw35 I've done a quick review, and my main request is to replace the print statements with calls to errorMessage. Nearly there!

@jshaw35
Copy link
Contributor Author

jshaw35 commented Dec 21, 2025

@mo-abodas how do things look now?

@alejandrobodas
Copy link
Collaborator

Thanks @jshaw35 it looks good to me!
@RobertPincus @dustinswales if you don't have any objections, I believe this PR can be merged.

Copy link
Contributor

@RobertPincus RobertPincus left a comment

Choose a reason for hiding this comment

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

Thanks @jshaw35 for all this hard work!

@RobertPincus
Copy link
Contributor

@alejandrobodas @jshaw35 Looks good, thanks for all this effort.

@jshaw35
Copy link
Contributor Author

jshaw35 commented Dec 23, 2025

@alejandrobodas great! When you merge could you also create a new tag to be used with CESM integration?

@alejandrobodas alejandrobodas merged commit 06fa420 into CFMIP:master Dec 24, 2025
4 checks passed
@alejandrobodas
Copy link
Collaborator

@jshaw35 PR merged and v2.2.0 created. Thanks again and congratulations!

@dustinswales
Copy link
Contributor

@jshaw35 Excellent work. Congratulations!
@alejandrobodas Thanks for all of your help with this PR!

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.

6 participants