bcgov / bcgov/nr-rfc-processing

Refactor / Revise how file Paths are handled

Open
#39 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
4
Forks
2
PR merge metrics
No merged PRs in 30d

Description

While there is some centralization of the file path configurations in the `admin.constants.py` module, code in the script is frequently building new paths from the constants provided in that module. Having the path manipulation code with business logic makes it difficult to read, and understand.

This ticket would create a path library that centralizes the calculation of paths and directories. Instead of code like:

```python
if sat == 'modis':
mosaic = glob(os.path.join(const.INTERMEDIATE_TIF_MODIS, date, 'modis_composite*.tif'))[0]
elif sat == 'viirs':
mosaic = glob(os.path.join(const.OUTPUT_TIF_VIIRS, date.split('.')[0], f'{date}.tif'))[0]
else:
```

Methods would be created to request the paths, example:
```python
mosaic = snow_pathlib.get_intermediate_composite_tifs(sat='modis', date=date)
```

Long term objective is to make the code easier to understand / maintain.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.