Fall back to MNH_VERSION when MASDEV is absent - #6
Open
HugoFara wants to merge 1 commit into
Open
Conversation
read_TIMESfiles indexed theFile['MASDEV'] unconditionally to decide whether a file is new enough to read. netCDF4 raises when the variable is missing, so any diagnostic file written without MASDEV aborts the read before the version test can be applied. Meso-NH writes an MNH_VERSION global attribute alongside MASDEV (src/MNH/io/mode_io_write_nc4.f90), and reads it back the same way in IO_Mnhversion_get, so use it as the fallback. The version test is also reworked to compare major and minor separately rather than treating the packed MASDEV integer as a single number. Ported from Meso-NH's in-tree copy of the module (src/LIB/Python/read_MNHfile.py), which has carried this since the 6.x IO changes; the two copies now match byte for byte again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
read_netcdfindexestheFile['MASDEV']unconditionally to decide whether a file is recent enough. netCDF4 raises when the variable is missing, so the read aborts before the version test runs:Reproduced with a diachronic file declaring
MNH_VERSION = [6, 1, 0]and noMASDEVvariable:mainraises the above, this branch reads it and returns the data.Meso-NH writes
MNH_VERSIONas three integers (src/MNH/io/mode_io_write_nc4.f90) and reads it back throughIO_Mnhversion_get, so this uses it as the fallback, and compares major and minor separately rather than treating the packedMASDEVinteger as one number.Ported from Meso-NH's copy at
src/LIB/Python/read_MNHfile.py; the two files are identical again.