Closed fraserwg closed 2 years ago
Hey @fraserwg, sorry this has been sitting around with no attention for a while. I'm curious, what happens when you read in a dataset in this case? Does xmitgcm
properly figure out how many levels there are?
So when xmitgcm
parses the available diagnostics file, this fix just sets the number of levels to np.NaN
if there's 1,000 or more vertical levels for the given diagnostic. The only place this variable seems to be subsequently used is when using the layers package. There's already a warning in place for if the number of layers cannot be inferred and I think this should trigger that warning as required. Short of refactoring the MITgcm
code which writes the available_diagnostics.log
file I don't think there's any other way to infer the number of levels available.
Ah, I see now, thanks for that explanation. This does only seem to impact the layers package, but I agree with how you wrote it. That is, I think it's better to catch the error and have levs
set before going into the subsequent if/else
tree so that the code is flexible for when levs==1
or in the case you're catching when np.isnan(levs)
.
Test looks good to me too. I say LGTM, and will merge early tomorrow unless there is any disagreement on that.
Thanks for your efforts @fraserwg!
This resolves issue #309.