Closed apcraig closed 10 months ago
@proteanplanet I invite you to take a look at this PR. @apcraig is setting up an Icepack test for the 5-band shortwave and needed to generalize the hardwired 5-band coding to do that. Personally, I think we should fix the hard-wired weirdnesses in here (see the code diff) to just do the linear interpolation all the time, but that will change answers. @apcraig has modified the code in a way that allows our testing without changing the 5-band shortwave answers. We can fix this later, but I'm pinging you here in case you'd like it done sooner. I'm not very happy with the current 5-band coding.
I just updated the implementation to cleanup the standard snicar 5-band rsnw_snicar_tab interpolation. This changes answers, but QC tests pass and the differences cannot be seen on the QC diff plot (attached). I ran run a small test suite focused on the snicar changes and that all works as expected. I am running a full test suite now, but don't expect any problems.
Full test suite on latest changes passes.
PR checklist
Add an interpolation method in icepack_shortwave.F90 for rsnw
Refactor portions of icepack_shortwave to improve robustness
Add snicar and snicartest test cases
Update the 5-band snicar shortwave rsnw_snicar_tab interpolation. This changes answers but QC tests pass. The new implementation checks whether the rsnw_snicar_tab is an array of integer values with deltas of value 1 (and sets the rsnw_snicar_chk variable). If so, it uses a shortcut to find the rsnw_snicar_tab bounds for interpolation, otherwise it calls the shortwave_search routine. In testing, the shortcut did not change performance much, but that could change in the future.