cgq-qgc / pyhelp

A Python library for the assessment of spatially distributed groundwater recharge and hydrological components with HELP
MIT License
17 stars 5 forks source link

PR: Rework input grid and weather data files declaration #90

Closed jnsebgosselin closed 2 years ago

jnsebgosselin commented 2 years ago

From now on, the grid and weather data will not be loaded automatically from input files with hard coded filenames.

It is now going to be required to provide explicitly the path of the grid and weather input data files when instantiating a new HelpManager. For example :

from pyhelp.managers import HelpManager

helpm = HelpManager(
    workdir= 'C:/pyhelp/example/',
    path_to_grid='C:/pyhelp/example/my_input_grid_.csv',
    path_to_precip='C:/pyhelp/example/my_precip_input_data.csv',
    path_to_airtemp='C:/pyhelp/example/my_airtemp_input_data.csv',
    path_to_solrad='C:/pyhelp/example/my_solrad_input_data.csv')

The grid and weather data will be automatically loaded from the provided input data files when instantiating HelpManager.

By making the declaration of pyhelp input file paths explicit, we hope to reduce confusion about when data is loaded in the pyhelp workflow and reduce the risk of error by allowing the user to directly declare their input files without having to rename any file in their operating system.

jnsebgosselin commented 2 years ago

@FHuchet @mraynauld après discussion avec Mélanie hier, j'ai décidé de rendre la déclaration des chemins d'accès vers les fichiers input de PyHELP explicite (au lieu d'utiliser des noms de fichier par défaut).

À partir de la version 0.3.1, il faudra donc fournir à PyHELP explicitement les chemins d'accès vers le fichier input de la grille et les fichiers input des données météo. Plus besoin donc de renommer vos fichiers d'entrée. Je pense que cela rendra la gestion des fichiers input plus claire dans le workflow et va réduire le risque de faire des erreurs.

Concrètement, au lieu de faire:

from pyhelp.managers import HelpManager

helpm = HelpManager(workdir='C:/pyhelp/example/')

Il faudra faire plutôt (dans PyHELP version 0.3.1 et + ):

from pyhelp.managers import HelpManager

helpm = HelpManager(
    workdir= 'C:/pyhelp/example/',
    path_to_grid='C:/pyhelp/example/my_input_grid_.csv',
    path_to_precip='C:/pyhelp/example/my_precip_input_data.csv',
    path_to_airtemp='C:/pyhelp/example/my_airtemp_input_data.csv',
    path_to_solrad='C:/pyhelp/example/my_solrad_input_data.csv')
FHuchet commented 2 years ago

Parfait. Cela me convient d'indiquer les chemins d'accès des fichiers input directement.