USGS-CMG / stglib

Routines used by the USGS Coastal/Marine Hazards & Resources Program to process oceanographic time-series data
Other
16 stars 13 forks source link

Paths should be path objects and not just concatenated strings #240

Open dnowacki-usgs opened 1 week ago

dnowacki-usgs commented 1 week ago

Currently we write paths as something like "your/path/goes/here".

And then modify paths by doing something like

    basefile = metadata["basefile"]

    if "prefix" in metadata:
        basefile = metadata["prefix"] + basefile

Those are string paths that we are concatenating using the addition operator.

This is not ideal, since it may be confusing to Windows users (who are used to seeing backslash-separated paths), the current method is not obvious, and because Python provides a more robust method of dealing with paths. We should consider using os.path or probably better, pathlib.