-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: Refactor PyHelp weather inputs and write documentation #12
Conversation
Generate an input PyHelp data file from CWEED files.
Load daily precipitation, average air temperature, or global solar radiation data from a correctly formatted PyHelp weather input files. The latitudes, longitudes, dates, and weather data values are stored in numpy arrays and returned as a dict with, respectively, the keys 'lat', 'lon', 'dates', and 'data'.
This is not going to be needed after the refactoring
Hello @jnsebgosselin! Thanks for updating the PR.
Comment last updated on October 18, 2018 at 16:19 Hours UTC |
Provided that the PyHhelp weather input files and input grid are already present in the working directory, running PyHelp simply comes down to: workdir = "C:/Users/User/pyhelp/example"
helpm = HelpManager(workdir, year_range=(2010, 2014))
helpm.build_help_input_files()
output_help = helpm.calc_help_cells('help_example.out', tfsoil=-3)
output_surf = helpm.calc_surf_water_cells(650, 'surf_example.out') |
The PyHelp input files can be generated automatically from the MDDELCC meteo grid and CWEED files with: workdir = "C:/Users/User/pyhelp/example"
helpm = HelpManager(workdir, year_range=(2010, 2014))
# Generate global solar irradiance input data file.
cweed2_paths = osp.join(workdir, 'CWEEDS', '94792.WY2')
cweed3_paths = osp.join(
workdir, 'CWEEDS', 'CAN_QC_MONTREAL-INTL-A_7025251_CWEEDS2011_T_N.WY3')
helpm.generate_weather_inputs_from_CWEEDS(cweed2_paths, cweed3_paths)
# Generate precip and avg air temp input data files.
path_to_mddelcc_grid = "F:/MeteoGrilleDaily"
helpm.generate_weather_inputs_from_MDELCC_grid(path_to_mddelcc_grid) |
This could cause problems if the working directory is changed outside of the class. Maybe this variable would need to be renamed at some point to avoid confusion.
For now, to avoid confusion, I will keep this hidden.
Fixes #11
The goal of this PR is to allow the use of PyHelp with weather data from any source.
At present, there is no easy way to use precipitation and air temperature data from sources other than the MDDELCC grid. Similarly, there is no easy way to use global solar irradiance data from sources other than the CWEEDS file. PyHelp generate directly the HELP D4, D7, and D13 input files directly from these sources.
This PR proposes to produce the HELP D4, D7, and D13 input files from pre-formatted csv files instead. Therefore, data from any sources can now be used, as long as the data are formatted in the specified format.
The format for the PyHelp weather input files will be the same for the precipitation, average air temperature, and global solar irradiance. An exemple is shown below.
Utilities will still be available to produce these PyHelp weather data input files from the MDDELCC meteo grid and CWEED files, since the code to do that is already available.