Skip to content

Inconsistent Storage-Elevation Curves in Different Operating Systems #2

@HishamEldardiry

Description

@HishamEldardiry

Description:
I found a bug in the CURVE.py script that caused inconsistencies in the Storage-Elevation curve. The issue was located at Line 73, where the script searches for the file containing the curves based on GRAND ID. The original implementation selected the first matching file found in the directory. However, because the files were not sorted, the selection varied depending on the computer or operating system being used (e.g., Windows vs Mac).

Proposed Fix:
To address this issue, I modified Line 73 in CURVE.py to ensure that we select the file that exactly matches the GRAND ID digits rather than relying on an unsorted list.

Old Line 73:
ID = [file for file in os.listdir() if str(int(grandID)) in file]

Updated Line 73:
ID = [file for file in os.listdir() if str(int(''.join(filter(str.isdigit, file)))) == str(int(grandID))]

This change ensures that only the correct file associated with the specific GRAND ID is selected, regardless of the file order in the directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions