uw-hydro / pysumma Goto Github PK
View Code? Open in Web Editor NEWPython module for managing SUMMA simulations
License: BSD 3-Clause "New" or "Revised" License
Python module for managing SUMMA simulations
License: BSD 3-Clause "New" or "Revised" License
Right now the status of the Ensemble
and Simulation
classes have status
attributes which are explicitly referenced. It would be nice to pull this out and encode it separately into something like a Status
class in a constants.py
type module.
Users should be able to read and write the variable terms in the Model_Output file.
Much of the functionality in the DecisionOption
class methods is also needed for the SimulationOption
class. It would be nicer to have an abstract Option
class that the two more specific classes can inherit from.
when summa is run through pysumma, can the command line output be displayed as python output? This information would be helpful especially when there are problems.
I think it makes more sense to use the variable name instead of the variable number when plotting a variable in the model outputs using the Plotting module.
(e.g., https://github.com/UW-Hydro/pysumma/blob/develop/pysumma/Plotting.py#L19)
The LAI method option ["specified"]
is no longer supported.Groundwater parameterization
must be (11)bigBucket
when using (28)singleBasin
for spatial_gw.pow_prof(power-law transmissivity profile)
must be selected when using (11) qTopmodl baseflow
optionupper boundary condition for thermodynamics
must be (13)presTemp
with (15) (16) presHead option
for soil hydrologylower boundary condition for thermodynamics
must be (14) zeroFlux
with (15) (16) presHead option
for soil hydrologyupper boundary condition for soil hydrology
must be (15) presHead
with (13)(14) presTemp
and (14) zeroFlux
options for thermodynamicslower boundary condition
for soil hydrology must be (16) zeroFlux
with (11) qTopmodl
option for groundwater.This appears that it will solve #67. It will also simplify the running of multiple simulations and/or ensembles.
Right now the output control object reads/writes only the old style of:
! varName | outFreq | inst | sum | mean | var | min | max | mode
scalarSenHeatTotal | 24 | 0 | 1 | 1 | 0 | 1 | 1 | 0
We should also support the new style:
scalarSWE | timestep | instant
scalarRainPlusMelt | day | mean
It seems pysumma depends on matplotlib, xarray, and seaborn. These libraries should be listed in the install_requires
.
cc @bartnijssen
When I try to change the summa groundwater decision to bigBuckt, I encounter an error which suggests that pysumma doesn't recognize this option. Notice the last line of the error message, which lists out valid options that has noXplict listed twice, and bigBuckt not listed.
Running this code:
def run_summa_error(site):
s = pysumma.Simulation.Simulation(fman_dict[site])
s.decision_obj.groundwatr.value = 'bigBuckt'
s.executable = '/opt/local/bin/summa.exe'
s.library_path = '/opt/local/lib:/opt/local/lib64:$LD_LIBRARY_PATH'
additional_args = ['export OMP_NUM_THREADS=8']
return s.execute('test_simpleResistance', 'local', additional_args)
I get:
ValueError Traceback (most recent call last)
in ()
----> 1 run_summa_error('Amplero')
in run_summa_error(site)
1 def run_summa_error(site):
2 s = pysumma.Simulation.Simulation(fman_dict[site])
----> 3 s.decision_obj.groundwatr.value = 'bigBuckt'
4 s.executable = '/opt/local/bin/summa.exe'
5 s.library_path = '/opt/local/lib:/opt/local/lib64:$LD_LIBRARY_PATH'
/pool0/data/tushark/pysumma/pysumma/Decisions.py in value(self, new_value)
77 self.write_value(self.value, new_value)
78 else:
---> 79 raise ValueError('Your input value {} is not one of the valid options {}'.format(new_value, self.options))
80
81
ValueError: Your input value bigBuckt is not one of the valid options ['qTopmodl', 'noXplict', 'noXplict']
Currently, if there are hru
and gru
dimensioned variables in the output you can't simply xr.concat
them because it is only possible to specify a single dimension to concatenate along. We can improve this by handling the gru
and hru
dimensioned variables separately, then merging that all together after.
It would be good to have a more informative error statement in the execute
method of the Simulation
class if an incorrect run_method
argument is passed.
It would be useful to be able to perform sensitivity analysis on forcing data. Currently this is not implemented, but could be added with some helper methods on the Ensemble
class or ensemble
module. To accomplish this we would need to:
Ensemble
configuration.I have been running some of these types of runs in an ad hoc manner by writing multiple file managers and forcing file lists with some shell scripts then using the following lines to set up the ensembles:
dT_list = ['-4.0K', '+0.0K', '+4.0K']
config_perturbed = {
'{}K_perturb'.format(dT):
{'file_manager': './file_manager_{}K.txt'.format(dT),
'decisions': {'snowLayers': 'jrdn1991'},
'parameters': {'windReductionParam': 0.90}
for dT in dT_list}
executable = 'summa.exe'
ens_dT = ps.Ensemble(executable, config_perturbed, num_workers=len(config_perturbed))
If I create 2 ensembles via:
import pysumma as ps
exe = 'summa.exe'
fman = 'file_manager.txt'
config1 = {...some_config...}
config2 = {...some_config...}
ens1 = ps.Ensemble(exe, config1, fman)
ens2 = ps.Ensemble(exe, config2, fman)
Then ens2.simulations
will contain simulations from both config1
and config2
. Clearly this was not the intended behavior.
The user should be able to run SUMMA using the SUMMA docker image via pysumma. This will likely go in execute
method in the Simulation
class.
Creating a new simulation object as follows:
# Define location of .exe and file manager
executable = '/usr/local/bin/summa.exe'
file_manager = '/home/jovyan/data/pbhm-exercise-2/settings/mizoguchi/summa_fileManager_mizoguchi.txt'
# Create a model instance
s = ps.Simulation(executable, file_manager)
Generates the following output printed to the screen:
/home/jovyan/data/pbhm-exercise-2/settings/mizoguchi/ ../GENPARM.TBL
Contents of the file manager file:
controlVersion 'SUMMA_FILE_MANAGER_V3.0.0'
simStartTime '2000-01-01 00:01'
simEndTime '2000-01-03 12:00'
tmZoneInfo 'localTime'
settingsPath '/home/jovyan/data/pbhm-exercise-2/settings/mizoguchi/'
forcingPath '/home/jovyan/data/pbhm-exercise-2/data/mizoguchi/'
outputPath '/home/jovyan/data/pbhm-exercise-2/output/mizoguchi/'
decisionsFile 'summa_zDecisions_mizoguchi.txt'
outputControlFile '../Model_Output.txt'
globalHruParamFile 'summa_zLocalParamInfo.txt'
globalGruParamFile 'summa_zBasinParamInfo.txt'
attributeFile 'summa_zLocalAttributes.nc'
trialParamFile 'summa_zParamTrial_mizoguchi.nc'
forcingListFile 'summa_zForcingFileList.txt'
initConditionFile 'summa_zInitialCond_mizoguchi.nc'
outFilePrefix 'mizoguchi1990'
vegTableFile '../VEGPARM.TBL'
soilTableFile '../SOILPARM.TBL'
generalTableFile '../GENPARM.TBL'
noahmpTableFile '../MPTABLE.TBL'
This issue occurs on Hydroshare, unsure about other environments.
Even though e.start() command finished in Jupyter Notebook, the output of summa is continuously generating. So we have to wait for this process finishing. Without waiting, when we try to combine output dataset from NetCDF, that makes errors.
I have the summa_plot repository that I started before pysumma was made. The functionality that I've implemented there should be merged into this project.
Step-1
Step-2
Step-3
Step-4
Step-5
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.