Git Product home page Git Product logo

criticalitymaps's Introduction

Patrick's github stats

criticalitymaps's People

Contributors

jhogge avatar pshassett avatar terrahaxton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

criticalitymaps's Issues

Allow custom functions for multiprocessing

It would be nice to be able to allow essentially any WNTR based simulation written as a function to be executed successively with the multiprocessing capabilities in this package.

The mp_queue_tools runner() takes a list of tuples of the function to be executed and the corresponding function args to be called with as input. The output is simply a list of all of the objects returned from the functions called.

In our applications it was convenient to output in a format for easy conversion to yml but this design choice could be left up to the user. Thoughts?

TemplateNotFound: ./templates/dataframe_map_template.html

Hey, first of all, what an amazing piece of work you did!

I have been trying to use the make_map function but it keeps throwing an error from the jinja package:

TemplateNotFound                          Traceback (most recent call last)
<ipython-input-12-9710dea75156> in <module>
      1 # my_wn_dataframe.make_map(output_file=None, map_columns=[], tooltip_columns=[], geojson_layers={})
----> 2 my_wn_dataframe.make_map(map_columns=["base demand", "diameter"], output_file='trialCM.html')
      3 
      4 # output_file: path and .html file name for map output.
      5 # map_columns: list of column names in the 'wn_dataframe' to be added as map layers (and automatically to tooltip)

~/anaconda3/envs/WNTR-trial3/lib/python3.7/site-packages/criticalityMaps/mapping/df_map.py in make_map(self, output_file, map_columns, tooltip_columns, geojson_layers)
    122         with open(output_file, 'w') as fp:
    123             fp.write(j2_env.get_template(
--> 124                     './templates/dataframe_map_template.html').render(
    125                     node_data=self.node_data,
    126                     node_map_fields=node_map_fields,

~/anaconda3/envs/WNTR-trial3/lib/python3.7/site-packages/jinja2/environment.py in get_template(self, name, parent, globals)
    881         if parent is not None:
    882             name = self.join_path(name, parent)
--> 883         return self._load_template(name, self.make_globals(globals))
    884 
    885     @internalcode

~/anaconda3/envs/WNTR-trial3/lib/python3.7/site-packages/jinja2/environment.py in _load_template(self, name, globals)
    855             ):
    856                 return template
--> 857         template = self.loader.load(self, name, globals)
    858         if self.cache is not None:
    859             self.cache[cache_key] = template

~/anaconda3/envs/WNTR-trial3/lib/python3.7/site-packages/jinja2/loaders.py in load(self, environment, name, globals)
    115         # first we try to get the source for this template together
    116         # with the filename and the uptodate function.
--> 117         source, filename, uptodate = self.get_source(environment, name)
    118 
    119         # try to load the code from the bytecode cache if there is a

~/anaconda3/envs/WNTR-trial3/lib/python3.7/site-packages/jinja2/loaders.py in get_source(self, environment, template)
    197 
    198             return contents, filename, uptodate
--> 199         raise TemplateNotFound(template)
    200 
    201     def list_templates(self):

TemplateNotFound: ./templates/dataframe_map_template.html

As it looks like, it is not finding the template folder, which is located at:

/Users/macadmin/Desktop/Projects/WNTR Copiapo/Jupyter notebooks/templates/

So, I decided to duplicate that folder (templates) inside the working directory where I start with (just at the side of the jupyter notebook I am running), just in case... So basically, I end up with a folders structure like this:

    Dashboard Demo.ipynb
    ...
    templates/
        dataframe_map_template.html
          ...

Even in this case, I get exactly the same error. I also tried moving the directory where I work on with os.chdir() but still the same error in all cases. Not sure what to do.
Important to notice: I created this virtual environment (WNTR-trial3), cloned the WNTR repository and source-installed the WNTR package. Then, I installed Criticalitymaps within this environment (conda list as follows):

(WNTR-trial3) macadmin@MacBook-Pro WNTR Copiapo % conda list
# packages in environment at /Users/macadmin/anaconda3/envs/WNTR-trial3:
#
# Name                    Version                   Build  Channel
appnope                   0.1.0                    py37_0  
asn1crypto                1.3.0                    py37_0  
attrs                     19.3.0                     py_0  
backcall                  0.1.0                    py37_0  
blas                      1.0                         mkl  
bleach                    3.1.0                    py37_0  
branca                    0.4.0                      py_0    conda-forge
ca-certificates           2020.1.1                      0  
certifi                   2019.11.28               py37_0  
cffi                      1.14.0           py37hb5b8e2f_0  
chardet                   3.0.4                 py37_1003  
criticalitymaps           0.1.0                    pypi_0    pypi
cryptography              2.8              py37ha12b0ac_0  
cycler                    0.10.0                   py37_0  
dbus                      1.13.12              h90a0687_0  
decorator                 4.4.1                      py_0  
defusedxml                0.6.0                      py_0  
entrypoints               0.3                      py37_0  
et_xmlfile                1.0.1                    py37_0  
expat                     2.2.6                h0a44026_0  
folium                    0.10.1                     py_0    conda-forge
freetype                  2.9.1                hb4e5f40_0  
gettext                   0.19.8.1             h15daf44_3  
glib                      2.63.1               hd977a24_0  
icu                       58.2                 h4b95b61_1  
idna                      2.8                      py37_0  
importlib_metadata        1.5.0                    py37_0  
intel-openmp              2019.4                      233  
ipykernel                 5.1.4            py37h39e3cac_0  
ipython                   7.12.0           py37h5ca1d4c_0  
ipython_genutils          0.2.0                    py37_0  
ipywidgets                7.5.1                      py_0  
jdcal                     1.4.1                      py_0  
jedi                      0.16.0                   py37_0  
jinja2                    2.11.1                     py_0  
jpeg                      9b                   he5867d9_2  
jsonschema                3.2.0                    py37_0  
jupyter                   1.0.0                    py37_7  
jupyter_client            5.3.4                    py37_0  
jupyter_console           6.1.0                      py_0  
jupyter_core              4.6.1                    py37_0  
kiwisolver                1.1.0            py37h0a44026_0  
libcxx                    4.0.1                hcfea43d_1  
libcxxabi                 4.0.1                hcfea43d_1  
libedit                   3.1.20181209         hb402a30_0  
libffi                    3.2.1                h475c297_4  
libgfortran               3.0.1                h93005f0_2  
libiconv                  1.15                 hdd342a3_7  
libpng                    1.6.37               ha441bb4_0  
libsodium                 1.0.16               h3efe00b_0  
markupsafe                1.1.1            py37h1de35cc_0  
matplotlib                3.1.3                    py37_0  
matplotlib-base           3.1.3            py37h9aa3819_0  
mistune                   0.8.4            py37h1de35cc_0  
mkl                       2019.4                      233  
mkl-service               2.3.0            py37hfbe908c_0  
mkl_fft                   1.0.15           py37h5e564d8_0  
mkl_random                1.1.0            py37ha771720_0  
nbconvert                 5.6.1                    py37_0  
nbformat                  5.0.4                      py_0  
ncurses                   6.1                  h0a44026_1  
networkx                  2.4                        py_0  
notebook                  6.0.3                    py37_0  
numpy                     1.18.1           py37h7241aed_0  
numpy-base                1.18.1           py37h6575580_1  
openpyxl                  3.0.3                      py_0  
openssl                   1.1.1d               h1de35cc_4  
pandas                    1.0.1            py37h6c726b0_0  
pandoc                    2.2.3.2                       0  
pandocfilters             1.4.2                    py37_1  
parso                     0.6.1                      py_0  
pcre                      8.43                 h0a44026_0  
pexpect                   4.8.0                    py37_0  
pickleshare               0.7.5                    py37_0  
pip                       20.0.2                   py37_1  
plotly                    4.5.0                      py_0  
prometheus_client         0.7.1                      py_0  
prompt_toolkit            3.0.3                      py_0  
ptyprocess                0.6.0                    py37_0  
pycparser                 2.19                     py37_0  
pygments                  2.5.2                      py_0  
pyopenssl                 19.1.0                   py37_0  
pyparsing                 2.4.6                      py_0  
pyqt                      5.9.2            py37h655552a_2  
pyrsistent                0.15.7           py37h1de35cc_0  
pysocks                   1.7.1                    py37_0  
python                    3.7.6                h359304d_2  
python-dateutil           2.8.1                      py_0  
pytz                      2019.3                     py_0  
pyyaml                    5.3                      pypi_0    pypi
pyzmq                     18.1.1           py37h0a44026_0  
qt                        5.9.7                h468cd18_1  
qtconsole                 4.6.0                      py_1  
readline                  7.0                  h1de35cc_5  
requests                  2.22.0                   py37_1  
retrying                  1.3.3                    py37_2  
scipy                     1.4.1            py37h9fa6033_0  
send2trash                1.5.0                    py37_0  
setuptools                45.2.0                   py37_0  
sip                       4.19.8           py37h0a44026_0  
six                       1.14.0                   py37_0  
sqlite                    3.31.1               ha441bb4_0  
terminado                 0.8.3                    py37_0  
testpath                  0.4.4                      py_0  
tk                        8.6.8                ha441bb4_0  
tornado                   6.0.3            py37h1de35cc_3  
traitlets                 4.3.3                    py37_0  
urllib3                   1.25.8                   py37_0  
utm                       0.5.0                      py_0    conda-forge
vincent                   0.4.4                      py_1    conda-forge
wcwidth                   0.1.8                      py_0  
webencodings              0.5.1                    py37_1  
wheel                     0.34.2                   py37_0  
widgetsnbextension        3.5.1                    py37_0  
wntr                      0.2.2                     dev_0    <develop>
xz                        5.2.4                h1de35cc_4  
zeromq                    4.3.1                h0a44026_3  
zipp                      2.2.0                      py_0  
zlib                      1.2.11               h1de35cc_3  

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.