worm-library 1.2.0__tar.gz → 1.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: worm_library
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Summary: Download WORM Portal tutorial notebooks and files
5
5
  Author-email: Grayson Boyer <gmboyer@asu.edu>
6
6
  License-Expression: MIT
@@ -43,7 +43,7 @@ Dynamic: license-file
43
43
 
44
44
  # worm_library
45
45
 
46
- Download WORM Portal tutorial notebooks and demo files to your local environment.
46
+ Download Water-Organic-Rock-Microbe (WORM) Portal tutorial notebooks and demo files to your local environment.
47
47
 
48
48
  ## Installation
49
49
 
@@ -51,8 +51,36 @@ Download WORM Portal tutorial notebooks and demo files to your local environment
51
51
  pip install worm_library
52
52
  ```
53
53
 
54
+ ## Quick Start
55
+
56
+ After installation, run this in your computer's terminal to download the WORM-Library notebook to your current directory and launch Jupyter Lab:
57
+
58
+ **Windows:**
59
+ ```powershell
60
+ python -c "import worm_library; worm_library.get_library_notebook()"; jupyter lab WORM-Library.ipynb
61
+ ```
62
+
63
+ **Mac/Linux:**
64
+ ```bash
65
+ python -c "import worm_library; worm_library.get_library_notebook()" && jupyter lab WORM-Library.ipynb
66
+ ```
67
+
68
+ This should open the WORM-Library notebook in your Jupyter Lab in your browser. It allows you to download the latest versions of WORM tutorials by running cells containing the desired tutorials.
69
+
70
+ Click on a cell with a tutorial that you want and then run it (`SHIFT+ENTER` while the cell is selected). When it is finished running, it will display a message saying that the tutorial is ready. Check the file browser for the tutorial folder that was downloaded. Double click on the folder to open it and access the downloaded tutorial notebook(s).
71
+
72
+ If you quit Jupyter Lab and want to return to it later, open your terminal and enter:
73
+
74
+ ```bash
75
+ jupyter lab WORM-Library.ipynb
76
+ ```
77
+
54
78
  ## Usage
55
79
 
80
+ It is easiest for new users to use the WORM-Library.ipynb notebook to download desired tutorials.
81
+
82
+ More advanced users can use Python in a terminal to access demos:
83
+
56
84
  ```python
57
85
  import worm_library
58
86
 
@@ -60,7 +88,6 @@ import worm_library
60
88
  worm_library.get_library_notebook()
61
89
 
62
90
  # Download specific tutorials
63
- worm_library.get_worm_tour() # WORM Tour introduction
64
91
  worm_library.get_introduction_demo() # Basic introduction
65
92
  worm_library.get_reaction_properties_demo() # Reaction properties tutorials
66
93
  worm_library.get_univariant_curve_demo() # Univariant curves / geothermometry
@@ -1,72 +1,99 @@
1
- # worm_library
2
-
3
- Download WORM Portal tutorial notebooks and demo files to your local environment.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- pip install worm_library
9
- ```
10
-
11
- ## Usage
12
-
13
- ```python
14
- import worm_library
15
-
16
- # Download the main WORM-Library notebook (index of all tutorials)
17
- worm_library.get_library_notebook()
18
-
19
- # Download specific tutorials
20
- worm_library.get_worm_tour() # WORM Tour introduction
21
- worm_library.get_introduction_demo() # Basic introduction
22
- worm_library.get_reaction_properties_demo() # Reaction properties tutorials
23
- worm_library.get_univariant_curve_demo() # Univariant curves / geothermometry
24
-
25
- # Aqueous speciation tutorials
26
- worm_library.get_intro_aqueous_speciation_demo()
27
- worm_library.get_multi_aqueous_speciation_demo()
28
- worm_library.get_charge_balance_demo()
29
- worm_library.get_heterogeneous_equilibrium_demo()
30
- worm_library.get_heterogeneous_equilibrium_gas_demo()
31
- worm_library.get_alter_suppress_demo()
32
- worm_library.get_custom_data0_demo()
33
- worm_library.get_EQ3_demo()
34
- worm_library.get_EQ6_demo()
35
-
36
- # Mass transfer tutorials
37
- worm_library.get_intro_mass_transfer_demo()
38
- worm_library.get_mass_transfer_feature_demo()
39
- worm_library.get_mixing_demo()
40
-
41
- # Additional tutorials
42
- worm_library.get_speciation_datasets_demo()
43
- worm_library.get_energy_supply_demo()
44
-
45
- # Thermodynamic property estimation
46
- worm_library.get_intro_aqorg_demo()
47
- worm_library.get_aqorg_feature_demo()
48
- worm_library.get_complicator_demo()
49
- worm_library.get_estimate_HKF_demo()
50
-
51
- # Community notebooks
52
- worm_library.get_Weeks_2025_demo()
53
- worm_library.get_Trinh_2026_demo()
54
- worm_library.get_whats_in_water_demo()
55
-
56
- # Workshop materials
57
- worm_library.get_workshop_demo("workshop_name")
58
-
59
- # Clean up all downloaded demos
60
- worm_library.delete_all_demos()
61
- ```
62
-
63
- Each function downloads the relevant notebooks and data files to a `Demo-*` folder in your current working directory.
64
-
65
- ## Links
66
-
67
- - [WORM Portal](https://worm-portal.asu.edu/)
68
- - [Full Tutorial Library on GitHub](https://github.com/worm-portal/WORM-Library)
69
-
70
- ## License
71
-
72
- MIT License - see [LICENSE](LICENSE) for details.
1
+ # worm_library
2
+
3
+ Download Water-Organic-Rock-Microbe (WORM) Portal tutorial notebooks and demo files to your local environment.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install worm_library
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ After installation, run this in your computer's terminal to download the WORM-Library notebook to your current directory and launch Jupyter Lab:
14
+
15
+ **Windows:**
16
+ ```powershell
17
+ python -c "import worm_library; worm_library.get_library_notebook()"; jupyter lab WORM-Library.ipynb
18
+ ```
19
+
20
+ **Mac/Linux:**
21
+ ```bash
22
+ python -c "import worm_library; worm_library.get_library_notebook()" && jupyter lab WORM-Library.ipynb
23
+ ```
24
+
25
+ This should open the WORM-Library notebook in your Jupyter Lab in your browser. It allows you to download the latest versions of WORM tutorials by running cells containing the desired tutorials.
26
+
27
+ Click on a cell with a tutorial that you want and then run it (`SHIFT+ENTER` while the cell is selected). When it is finished running, it will display a message saying that the tutorial is ready. Check the file browser for the tutorial folder that was downloaded. Double click on the folder to open it and access the downloaded tutorial notebook(s).
28
+
29
+ If you quit Jupyter Lab and want to return to it later, open your terminal and enter:
30
+
31
+ ```bash
32
+ jupyter lab WORM-Library.ipynb
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ It is easiest for new users to use the WORM-Library.ipynb notebook to download desired tutorials.
38
+
39
+ More advanced users can use Python in a terminal to access demos:
40
+
41
+ ```python
42
+ import worm_library
43
+
44
+ # Download the main WORM-Library notebook (index of all tutorials)
45
+ worm_library.get_library_notebook()
46
+
47
+ # Download specific tutorials
48
+ worm_library.get_introduction_demo() # Basic introduction
49
+ worm_library.get_reaction_properties_demo() # Reaction properties tutorials
50
+ worm_library.get_univariant_curve_demo() # Univariant curves / geothermometry
51
+
52
+ # Aqueous speciation tutorials
53
+ worm_library.get_intro_aqueous_speciation_demo()
54
+ worm_library.get_multi_aqueous_speciation_demo()
55
+ worm_library.get_charge_balance_demo()
56
+ worm_library.get_heterogeneous_equilibrium_demo()
57
+ worm_library.get_heterogeneous_equilibrium_gas_demo()
58
+ worm_library.get_alter_suppress_demo()
59
+ worm_library.get_custom_data0_demo()
60
+ worm_library.get_EQ3_demo()
61
+ worm_library.get_EQ6_demo()
62
+
63
+ # Mass transfer tutorials
64
+ worm_library.get_intro_mass_transfer_demo()
65
+ worm_library.get_mass_transfer_feature_demo()
66
+ worm_library.get_mixing_demo()
67
+
68
+ # Additional tutorials
69
+ worm_library.get_speciation_datasets_demo()
70
+ worm_library.get_energy_supply_demo()
71
+
72
+ # Thermodynamic property estimation
73
+ worm_library.get_intro_aqorg_demo()
74
+ worm_library.get_aqorg_feature_demo()
75
+ worm_library.get_complicator_demo()
76
+ worm_library.get_estimate_HKF_demo()
77
+
78
+ # Community notebooks
79
+ worm_library.get_Weeks_2025_demo()
80
+ worm_library.get_Trinh_2026_demo()
81
+ worm_library.get_whats_in_water_demo()
82
+
83
+ # Workshop materials
84
+ worm_library.get_workshop_demo("workshop_name")
85
+
86
+ # Clean up all downloaded demos
87
+ worm_library.delete_all_demos()
88
+ ```
89
+
90
+ Each function downloads the relevant notebooks and data files to a `Demo-*` folder in your current working directory.
91
+
92
+ ## Links
93
+
94
+ - [WORM Portal](https://worm-portal.asu.edu/)
95
+ - [Full Tutorial Library on GitHub](https://github.com/worm-portal/WORM-Library)
96
+
97
+ ## License
98
+
99
+ MIT License - see [LICENSE](LICENSE) for details.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "worm_library"
7
- version = "1.2.0"
7
+ version = "1.2.2"
8
8
  description = "Download WORM Portal tutorial notebooks and files"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -1,6 +1,6 @@
1
- from .downloader import get_worm_tour, get_introduction_demo
2
- from .downloader import get_reaction_properties_demo, get_univariant_curve_demo
3
- from .downloader import get_intro_aqueous_speciation_demo, get_multi_aqueous_speciation_demo, get_charge_balance_demo, get_heterogeneous_equilibrium_demo, get_heterogeneous_equilibrium_gas_demo, get_alter_suppress_demo, get_custom_data0_demo, get_EQ3_demo, get_EQ6_demo, get_intro_mass_transfer_demo, get_mass_transfer_feature_demo, get_mixing_demo, get_speciation_datasets_demo, get_energy_supply_demo
4
- from .downloader import get_intro_aqorg_demo, get_aqorg_feature_demo, get_complicator_demo, get_estimate_HKF_demo
5
- from .downloader import get_workshop_demo, delete_all_demos, get_library_notebook
1
+ from .downloader import get_worm_tour, get_introduction_demo
2
+ from .downloader import get_reaction_properties_demo, get_univariant_curve_demo
3
+ from .downloader import get_intro_aqueous_speciation_demo, get_multi_aqueous_speciation_demo, get_charge_balance_demo, get_heterogeneous_equilibrium_demo, get_heterogeneous_equilibrium_gas_demo, get_alter_suppress_demo, get_custom_data0_demo, get_EQ3_demo, get_EQ6_demo, get_intro_mass_transfer_demo, get_mass_transfer_feature_demo, get_mixing_demo, get_speciation_datasets_demo, get_energy_supply_demo
4
+ from .downloader import get_intro_aqorg_demo, get_aqorg_feature_demo, get_complicator_demo, get_estimate_HKF_demo
5
+ from .downloader import get_workshop_demo, delete_all_demos, get_library_notebook
6
6
  from .downloader import get_Weeks_2025_demo, get_Trinh_2026_demo, get_whats_in_water_demo
@@ -1,222 +1,222 @@
1
- from urllib.request import urlopen, urlretrieve
2
- from pathlib import Path
3
- import shutil
4
- from bs4 import BeautifulSoup as bs
5
- import requests
6
- import os
7
- from glob import glob
8
- from shutil import rmtree
9
- import json
10
- import re
11
-
12
- def get_WORM_demo(demo_name, URL):
13
-
14
- # check to see if this notebook is being run inside of the read-only WORM Library folder
15
- cwd = os.getcwd()
16
-
17
- # main and raw URL prefixes for the WORM library
18
- URL_main_prefix = 'https://github.com/worm-portal/WORM-Library/tree/master/'
19
- URL_raw_prefix = 'https://raw.githubusercontent.com/worm-portal/WORM-Library/master/'
20
-
21
- # delete demo folder if it exists
22
- dirpath = Path(demo_name)
23
- if dirpath.exists() and dirpath.is_dir():
24
- shutil.rmtree(dirpath)
25
-
26
- # create a fresh demo folder
27
- dirpath.mkdir()
28
-
29
- res = requests.get(URL_main_prefix+URL)
30
- soup = bs(res.text, 'lxml')
31
- # repo_files = soup.find_all('a', class_="js-navigation-open")
32
-
33
- #gitstr = str(soup.find_all('p')[0])
34
-
35
- try:
36
- try:
37
- gitstr = str([s for s in soup.find_all('script') if "payload" in str(s)][0])
38
- gitstr = gitstr.split(">")[1].split("<")[0]
39
- repo_files = [d["path"].split(URL+"/")[1] for d in json.loads(gitstr)["payload"]["tree"]["items"]]
40
- except:
41
- gitstr = str([s for s in soup.find_all('script') if "payload" in str(s)][1])
42
- gitstr = gitstr.split(">")[1].split("<")[0]
43
- repo_files = [d["path"].split(URL+"/")[1] for d in json.loads(gitstr)["payload"]["tree"]["items"]]
44
-
45
- # correct for ampersand in file names
46
- # e.g., S&amp;C10vents.csv becomes S&C10vents.csv
47
- repo_files = [re.sub("&amp;", "&", f) for f in repo_files]
48
- except:
49
- raise Exception("The WORM Library is currently experiencing difficulty connecting to GitHub where demos are "
50
- "hosted. Please inform Grayson Boyer gmboyer@asu.edu")
51
-
52
- files = []
53
- for i in repo_files:
54
- if ('.csv' in i or '.ipynb' in i or '.3i' in i or '.6i' in i or '.cmp' in i or '.speciation' in i) and '.ipynb_checkpoints' not in i:
55
- files.append(i)
56
-
57
- for file in files:
58
- if '.speciation' not in file:
59
- # Download from URL and decode as UTF-8 text.
60
- with urlopen(URL_raw_prefix+URL+"/"+file) as webpage:
61
- content = webpage.read().decode()
62
-
63
- # Save to file.
64
- with open(demo_name+"/"+file, 'w', encoding='utf-8') as output:
65
- output.write(content)
66
- else:
67
- urlretrieve(URL_raw_prefix+URL+"/"+file, demo_name+"/"+file)
68
-
69
- print(demo_name+" is ready.")
70
-
71
-
72
- def get_worm_tour():
73
- demo_name = "Demo-0-WORM-Tour"
74
- URL = "WORM-Tour"
75
- get_WORM_demo(demo_name, URL)
76
-
77
- def get_introduction_demo():
78
- demo_name = "Demo-1-Introduction"
79
- URL = "1-Introduction"
80
- get_WORM_demo(demo_name, URL)
81
-
82
- def get_reaction_properties_demo():
83
- demo_name = "Demo-2-(1-2-3)-Reaction-Properties"
84
- URL = "2-Reaction-Properties"
85
- get_WORM_demo(demo_name, URL)
86
-
87
- def get_univariant_curve_demo():
88
- demo_name = "Demo-2-4-Geothermometry-Univariant"
89
- URL = "2-Reaction-Properties/4-Univariant-Curves"
90
- get_WORM_demo(demo_name, URL)
91
-
92
- def get_intro_aqueous_speciation_demo():
93
- demo_name = "Demo-3-1-Intro-Aqueous_Speciation"
94
- URL = "3-Aqueous-Speciation/1-Introduction-to-Aq-Speciation"
95
- get_WORM_demo(demo_name, URL)
96
-
97
- def get_multi_aqueous_speciation_demo():
98
- demo_name = "Demo-3-2-Multi-Aqueous_Speciation"
99
- URL = "3-Aqueous-Speciation/2-Multi-Sample-Speciation"
100
- get_WORM_demo(demo_name, URL)
101
-
102
- def get_charge_balance_demo():
103
- demo_name = "Demo-3-3-Charge-Balance"
104
- URL = "3-Aqueous-Speciation/3-Charge-Balancing"
105
- get_WORM_demo(demo_name, URL)
106
-
107
- def get_heterogeneous_equilibrium_demo():
108
- demo_name = "Demo-3-4-1-Heterogeneous-Equilibrium"
109
- URL = "3-Aqueous-Speciation/4-Custom-Database/1-Introduction"
110
- get_WORM_demo(demo_name, URL)
111
-
112
- def get_heterogeneous_equilibrium_gas_demo():
113
- demo_name = "Demo-3-4-2-Gas-Equilibrium"
114
- URL = "3-Aqueous-Speciation/Heterogeneous-Equil-Dissolve-Gas"
115
- get_WORM_demo(demo_name, URL)
116
-
117
- def get_alter_suppress_demo():
118
- demo_name = "Demo-3-5-Alter-Suppress"
119
- URL = "3-Aqueous-Speciation/5-Alter-and-Suppress"
120
- get_WORM_demo(demo_name, URL)
121
-
122
- def get_EQ3_demo():
123
- demo_name = "Demo-3-6-1-EQ3"
124
- URL = "3-Aqueous-Speciation/6-Extras/speciate-3i-file"
125
- get_WORM_demo(demo_name, URL)
126
-
127
- def get_EQ6_demo():
128
- demo_name = "Demo-3-6-2-EQ6"
129
- URL = "3-Aqueous-Speciation/6-Extras/speciate-6i-file"
130
- get_WORM_demo(demo_name, URL)
131
-
132
- def get_custom_data0_demo():
133
- demo_name = "Demo-3-6-3-Custom-data0"
134
- URL = "3-Aqueous-Speciation/4-Custom-Database/2-Creating-data0-files"
135
- get_WORM_demo(demo_name, URL)
136
-
137
- def get_intro_mass_transfer_demo():
138
- demo_name = "Demo-3-7-1-Intro-Mass-Transfer"
139
- URL = "3-Aqueous-Speciation/7-Mass-Transfer/1-Introduction"
140
- get_WORM_demo(demo_name, URL)
141
-
142
- def get_mass_transfer_feature_demo():
143
- demo_name = "Demo-3-7-2-Mass-Transfer-Features"
144
- URL = "3-Aqueous-Speciation/7-Mass-Transfer/2-Feature-Demo"
145
- get_WORM_demo(demo_name, URL)
146
-
147
- def get_mixing_demo():
148
- demo_name = "Demo-3-7-3-Mixing-Fluids"
149
- URL = "3-Aqueous-Speciation/7-Mass-Transfer/3-Fluid-Mixing"
150
- get_WORM_demo(demo_name, URL)
151
-
152
- def get_speciation_datasets_demo():
153
- demo_name = "Demo-3-8-Dataset-Exploration"
154
- URL = "3-Aqueous-Speciation/6-Extras/speciation-datasets"
155
- get_WORM_demo(demo_name, URL)
156
-
157
- def get_energy_supply_demo():
158
- demo_name = "Demo-3-9-Energy-Supplies"
159
- URL = "3-Aqueous-Speciation/Intro-to-Energy-Supplies"
160
- get_WORM_demo(demo_name, URL)
161
-
162
- def get_intro_aqorg_demo():
163
- demo_name = "Demo-4-1-1-Intro-AqOrg"
164
- URL = "4-Thermodynamic-Property-Estimation"
165
- get_WORM_demo(demo_name, URL)
166
-
167
- def get_aqorg_feature_demo():
168
- demo_name = "Demo-4-1-2-AqOrg-Features"
169
- URL = "4-Thermodynamic-Property-Estimation/Aq-Organics-Feature-Demo"
170
- get_WORM_demo(demo_name, URL)
171
-
172
- def get_complicator_demo():
173
- demo_name = "Demo-4-2-1-WORM-Complicator"
174
- URL = "4-Thermodynamic-Property-Estimation/Complicator"
175
- get_WORM_demo(demo_name, URL)
176
-
177
- def get_estimate_HKF_demo():
178
- demo_name = "Demo-4-3-Estimate-HKF-Parameters"
179
- URL = "4-Thermodynamic-Property-Estimation/Estimate-HKF-Parameters"
180
- get_WORM_demo(demo_name, URL)
181
-
182
- def get_Weeks_2025_demo():
183
- demo_name = "Demo-5-Ammonia-Speciation-Weeks-et-al-2025"
184
- URL = "5-Community-WORM-Notebooks/Ammonia-Speciation-Weeks-et-al-2025"
185
- get_WORM_demo(demo_name, URL)
186
-
187
- def get_Trinh_2026_demo():
188
- demo_name = "Demo-5-Europa-Methanogenesis-Trinh-et-al-2026"
189
- URL = "5-Community-WORM-Notebooks/Europa-Methanogenesis-Trinh-et-al-2026"
190
- get_WORM_demo(demo_name, URL)
191
-
192
- def get_whats_in_water_demo():
193
- demo_name = "Demo-5-Whats-In-Your-Water-Weeks-Debes-2025"
194
- URL = "5-Community-WORM-Notebooks/Whats-In-Your-Water-Weeks-Debes-2025"
195
- get_WORM_demo(demo_name, URL)
196
-
197
- def get_workshop_demo(workshop_name):
198
- demo_name = "Demo-Workshop-"+workshop_name
199
- URL = "WORKSHOP"
200
- get_WORM_demo(demo_name, URL)
201
-
202
- def delete_all_demos():
203
- path = os.getcwd()
204
- pattern = os.path.join(path, "Demo-*")
205
-
206
- for item in glob(pattern):
207
- if not os.path.isdir(item):
208
- continue
209
- rmtree(item)
210
-
211
- def get_library_notebook():
212
- """Download the latest WORM-Library.ipynb notebook to the current working directory."""
213
- URL_raw_prefix = 'https://raw.githubusercontent.com/worm-portal/WORM-Library/master/'
214
- filename = 'WORM-Library.ipynb'
215
-
216
- with urlopen(URL_raw_prefix + filename) as webpage:
217
- content = webpage.read().decode()
218
-
219
- with open(filename, 'w', encoding='utf-8') as output:
220
- output.write(content)
221
-
1
+ from urllib.request import urlopen, urlretrieve
2
+ from pathlib import Path
3
+ import shutil
4
+ from bs4 import BeautifulSoup as bs
5
+ import requests
6
+ import os
7
+ from glob import glob
8
+ from shutil import rmtree
9
+ import json
10
+ import re
11
+
12
+ def get_WORM_demo(demo_name, URL):
13
+
14
+ # check to see if this notebook is being run inside of the read-only WORM Library folder
15
+ cwd = os.getcwd()
16
+
17
+ # main and raw URL prefixes for the WORM library
18
+ URL_main_prefix = 'https://github.com/worm-portal/WORM-Library/tree/master/'
19
+ URL_raw_prefix = 'https://raw.githubusercontent.com/worm-portal/WORM-Library/master/'
20
+
21
+ # delete demo folder if it exists
22
+ dirpath = Path(demo_name)
23
+ if dirpath.exists() and dirpath.is_dir():
24
+ shutil.rmtree(dirpath)
25
+
26
+ # create a fresh demo folder
27
+ dirpath.mkdir()
28
+
29
+ res = requests.get(URL_main_prefix+URL)
30
+ soup = bs(res.text, 'lxml')
31
+ # repo_files = soup.find_all('a', class_="js-navigation-open")
32
+
33
+ #gitstr = str(soup.find_all('p')[0])
34
+
35
+ try:
36
+ try:
37
+ gitstr = str([s for s in soup.find_all('script') if "payload" in str(s)][0])
38
+ gitstr = gitstr.split(">")[1].split("<")[0]
39
+ repo_files = [d["path"].split(URL+"/")[1] for d in json.loads(gitstr)["payload"]["tree"]["items"]]
40
+ except:
41
+ gitstr = str([s for s in soup.find_all('script') if "payload" in str(s)][1])
42
+ gitstr = gitstr.split(">")[1].split("<")[0]
43
+ repo_files = [d["path"].split(URL+"/")[1] for d in json.loads(gitstr)["payload"]["tree"]["items"]]
44
+
45
+ # correct for ampersand in file names
46
+ # e.g., S&amp;C10vents.csv becomes S&C10vents.csv
47
+ repo_files = [re.sub("&amp;", "&", f) for f in repo_files]
48
+ except:
49
+ raise Exception("The WORM Library is currently experiencing difficulty connecting to GitHub where demos are "
50
+ "hosted. Please inform Grayson Boyer gmboyer@asu.edu")
51
+
52
+ files = []
53
+ for i in repo_files:
54
+ if ('.csv' in i or '.ipynb' in i or '.3i' in i or '.6i' in i or '.cmp' in i or '.speciation' in i) and '.ipynb_checkpoints' not in i:
55
+ files.append(i)
56
+
57
+ for file in files:
58
+ if '.speciation' not in file and '.3i' not in file and '.6i' not in file and '.cmp' not in file:
59
+ # Download from URL and decode as UTF-8 text.
60
+ with urlopen(URL_raw_prefix+URL+"/"+file) as webpage:
61
+ content = webpage.read().decode()
62
+
63
+ # Save to file.
64
+ with open(demo_name+"/"+file, 'w', encoding='utf-8') as output:
65
+ output.write(content)
66
+ else:
67
+ urlretrieve(URL_raw_prefix+URL+"/"+file, demo_name+"/"+file)
68
+
69
+ print(demo_name+" is ready.")
70
+
71
+
72
+ def get_worm_tour():
73
+ demo_name = "Demo-0-WORM-Tour"
74
+ URL = "WORM-Tour"
75
+ get_WORM_demo(demo_name, URL)
76
+
77
+ def get_introduction_demo():
78
+ demo_name = "Demo-1-Introduction"
79
+ URL = "1-Introduction"
80
+ get_WORM_demo(demo_name, URL)
81
+
82
+ def get_reaction_properties_demo():
83
+ demo_name = "Demo-2-(1-2-3)-Reaction-Properties"
84
+ URL = "2-Reaction-Properties"
85
+ get_WORM_demo(demo_name, URL)
86
+
87
+ def get_univariant_curve_demo():
88
+ demo_name = "Demo-2-4-Geothermometry-Univariant"
89
+ URL = "2-Reaction-Properties/4-Univariant-Curves"
90
+ get_WORM_demo(demo_name, URL)
91
+
92
+ def get_intro_aqueous_speciation_demo():
93
+ demo_name = "Demo-3-1-Intro-Aqueous_Speciation"
94
+ URL = "3-Aqueous-Speciation/1-Introduction-to-Aq-Speciation"
95
+ get_WORM_demo(demo_name, URL)
96
+
97
+ def get_multi_aqueous_speciation_demo():
98
+ demo_name = "Demo-3-2-Multi-Aqueous_Speciation"
99
+ URL = "3-Aqueous-Speciation/2-Multi-Sample-Speciation"
100
+ get_WORM_demo(demo_name, URL)
101
+
102
+ def get_charge_balance_demo():
103
+ demo_name = "Demo-3-3-Charge-Balance"
104
+ URL = "3-Aqueous-Speciation/3-Charge-Balancing"
105
+ get_WORM_demo(demo_name, URL)
106
+
107
+ def get_heterogeneous_equilibrium_demo():
108
+ demo_name = "Demo-3-4-1-Heterogeneous-Equilibrium"
109
+ URL = "3-Aqueous-Speciation/4-Custom-Database/1-Introduction"
110
+ get_WORM_demo(demo_name, URL)
111
+
112
+ def get_heterogeneous_equilibrium_gas_demo():
113
+ demo_name = "Demo-3-4-2-Gas-Equilibrium"
114
+ URL = "3-Aqueous-Speciation/Heterogeneous-Equil-Dissolve-Gas"
115
+ get_WORM_demo(demo_name, URL)
116
+
117
+ def get_alter_suppress_demo():
118
+ demo_name = "Demo-3-5-Alter-Suppress"
119
+ URL = "3-Aqueous-Speciation/5-Alter-and-Suppress"
120
+ get_WORM_demo(demo_name, URL)
121
+
122
+ def get_EQ3_demo():
123
+ demo_name = "Demo-3-6-1-EQ3"
124
+ URL = "3-Aqueous-Speciation/6-Extras/speciate-3i-file"
125
+ get_WORM_demo(demo_name, URL)
126
+
127
+ def get_EQ6_demo():
128
+ demo_name = "Demo-3-6-2-EQ6"
129
+ URL = "3-Aqueous-Speciation/6-Extras/speciate-6i-file"
130
+ get_WORM_demo(demo_name, URL)
131
+
132
+ def get_custom_data0_demo():
133
+ demo_name = "Demo-3-6-3-Custom-data0"
134
+ URL = "3-Aqueous-Speciation/4-Custom-Database/2-Creating-data0-files"
135
+ get_WORM_demo(demo_name, URL)
136
+
137
+ def get_intro_mass_transfer_demo():
138
+ demo_name = "Demo-3-7-1-Intro-Mass-Transfer"
139
+ URL = "3-Aqueous-Speciation/7-Mass-Transfer/1-Introduction"
140
+ get_WORM_demo(demo_name, URL)
141
+
142
+ def get_mass_transfer_feature_demo():
143
+ demo_name = "Demo-3-7-2-Mass-Transfer-Features"
144
+ URL = "3-Aqueous-Speciation/7-Mass-Transfer/2-Feature-Demo"
145
+ get_WORM_demo(demo_name, URL)
146
+
147
+ def get_mixing_demo():
148
+ demo_name = "Demo-3-7-3-Mixing-Fluids"
149
+ URL = "3-Aqueous-Speciation/7-Mass-Transfer/3-Fluid-Mixing"
150
+ get_WORM_demo(demo_name, URL)
151
+
152
+ def get_speciation_datasets_demo():
153
+ demo_name = "Demo-3-8-Dataset-Exploration"
154
+ URL = "3-Aqueous-Speciation/6-Extras/speciation-datasets"
155
+ get_WORM_demo(demo_name, URL)
156
+
157
+ def get_energy_supply_demo():
158
+ demo_name = "Demo-3-9-Energy-Supplies"
159
+ URL = "3-Aqueous-Speciation/Intro-to-Energy-Supplies"
160
+ get_WORM_demo(demo_name, URL)
161
+
162
+ def get_intro_aqorg_demo():
163
+ demo_name = "Demo-4-1-1-Intro-AqOrg"
164
+ URL = "4-Thermodynamic-Property-Estimation"
165
+ get_WORM_demo(demo_name, URL)
166
+
167
+ def get_aqorg_feature_demo():
168
+ demo_name = "Demo-4-1-2-AqOrg-Features"
169
+ URL = "4-Thermodynamic-Property-Estimation/Aq-Organics-Feature-Demo"
170
+ get_WORM_demo(demo_name, URL)
171
+
172
+ def get_complicator_demo():
173
+ demo_name = "Demo-4-2-1-WORM-Complicator"
174
+ URL = "4-Thermodynamic-Property-Estimation/Complicator"
175
+ get_WORM_demo(demo_name, URL)
176
+
177
+ def get_estimate_HKF_demo():
178
+ demo_name = "Demo-4-3-Estimate-HKF-Parameters"
179
+ URL = "4-Thermodynamic-Property-Estimation/Estimate-HKF-Parameters"
180
+ get_WORM_demo(demo_name, URL)
181
+
182
+ def get_Weeks_2025_demo():
183
+ demo_name = "Demo-5-Ammonia-Speciation-Weeks-et-al-2025"
184
+ URL = "5-Community-WORM-Notebooks/Ammonia-Speciation-Weeks-et-al-2025"
185
+ get_WORM_demo(demo_name, URL)
186
+
187
+ def get_Trinh_2026_demo():
188
+ demo_name = "Demo-5-Europa-Methanogenesis-Trinh-et-al-2026"
189
+ URL = "5-Community-WORM-Notebooks/Europa-Methanogenesis-Trinh-et-al-2026"
190
+ get_WORM_demo(demo_name, URL)
191
+
192
+ def get_whats_in_water_demo():
193
+ demo_name = "Demo-5-Whats-In-Your-Water-Weeks-Debes-2025"
194
+ URL = "5-Community-WORM-Notebooks/Whats-In-Your-Water-Weeks-Debes-2025"
195
+ get_WORM_demo(demo_name, URL)
196
+
197
+ def get_workshop_demo(workshop_name):
198
+ demo_name = "Demo-Workshop-"+workshop_name
199
+ URL = "WORKSHOP"
200
+ get_WORM_demo(demo_name, URL)
201
+
202
+ def delete_all_demos():
203
+ path = os.getcwd()
204
+ pattern = os.path.join(path, "Demo-*")
205
+
206
+ for item in glob(pattern):
207
+ if not os.path.isdir(item):
208
+ continue
209
+ rmtree(item)
210
+
211
+ def get_library_notebook():
212
+ """Download the latest WORM-Library.ipynb notebook to the current working directory."""
213
+ URL_raw_prefix = 'https://raw.githubusercontent.com/worm-portal/WORM-Library/master/'
214
+ filename = 'WORM-Library.ipynb'
215
+
216
+ with urlopen(URL_raw_prefix + filename) as webpage:
217
+ content = webpage.read().decode()
218
+
219
+ with open(filename, 'w', encoding='utf-8') as output:
220
+ output.write(content)
221
+
222
222
  print(f"{filename} downloaded successfully.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: worm_library
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Summary: Download WORM Portal tutorial notebooks and files
5
5
  Author-email: Grayson Boyer <gmboyer@asu.edu>
6
6
  License-Expression: MIT
@@ -43,7 +43,7 @@ Dynamic: license-file
43
43
 
44
44
  # worm_library
45
45
 
46
- Download WORM Portal tutorial notebooks and demo files to your local environment.
46
+ Download Water-Organic-Rock-Microbe (WORM) Portal tutorial notebooks and demo files to your local environment.
47
47
 
48
48
  ## Installation
49
49
 
@@ -51,8 +51,36 @@ Download WORM Portal tutorial notebooks and demo files to your local environment
51
51
  pip install worm_library
52
52
  ```
53
53
 
54
+ ## Quick Start
55
+
56
+ After installation, run this in your computer's terminal to download the WORM-Library notebook to your current directory and launch Jupyter Lab:
57
+
58
+ **Windows:**
59
+ ```powershell
60
+ python -c "import worm_library; worm_library.get_library_notebook()"; jupyter lab WORM-Library.ipynb
61
+ ```
62
+
63
+ **Mac/Linux:**
64
+ ```bash
65
+ python -c "import worm_library; worm_library.get_library_notebook()" && jupyter lab WORM-Library.ipynb
66
+ ```
67
+
68
+ This should open the WORM-Library notebook in your Jupyter Lab in your browser. It allows you to download the latest versions of WORM tutorials by running cells containing the desired tutorials.
69
+
70
+ Click on a cell with a tutorial that you want and then run it (`SHIFT+ENTER` while the cell is selected). When it is finished running, it will display a message saying that the tutorial is ready. Check the file browser for the tutorial folder that was downloaded. Double click on the folder to open it and access the downloaded tutorial notebook(s).
71
+
72
+ If you quit Jupyter Lab and want to return to it later, open your terminal and enter:
73
+
74
+ ```bash
75
+ jupyter lab WORM-Library.ipynb
76
+ ```
77
+
54
78
  ## Usage
55
79
 
80
+ It is easiest for new users to use the WORM-Library.ipynb notebook to download desired tutorials.
81
+
82
+ More advanced users can use Python in a terminal to access demos:
83
+
56
84
  ```python
57
85
  import worm_library
58
86
 
@@ -60,7 +88,6 @@ import worm_library
60
88
  worm_library.get_library_notebook()
61
89
 
62
90
  # Download specific tutorials
63
- worm_library.get_worm_tour() # WORM Tour introduction
64
91
  worm_library.get_introduction_demo() # Basic introduction
65
92
  worm_library.get_reaction_properties_demo() # Reaction properties tutorials
66
93
  worm_library.get_univariant_curve_demo() # Univariant curves / geothermometry
File without changes
File without changes
File without changes