ngiab-data-preprocess 4.2.0__py3-none-any.whl → 4.2.2__py3-none-any.whl

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.
@@ -34,24 +34,27 @@
34
34
  background-color: white;
35
35
  border-radius: 18px;
36
36
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
37
- transition: transform 0.3s ease, box-shadow 0.3s ease;
37
+ transition:
38
+ transform 0.3s ease,
39
+ box-shadow 0.3s ease;
38
40
  display: flex;
39
41
  justify-content: center;
40
42
  align-items: center;
41
43
  font-size: 14px;
42
44
  font-weight: bold;
43
- color: #4CAF50; /* Default color for the selected text */
45
+ color: #4caf50; /* Default color for the selected text */
44
46
  }
45
47
 
46
48
  /* Toggle Text (NWM and AORC labels) */
47
49
  .toggle-text {
48
50
  position: absolute;
49
51
  top: 50%;
52
+ min-width: 40px;
53
+ text-align: center;
50
54
  transform: translateY(-50%);
51
55
  font-size: 14px;
52
56
  font-weight: bold;
53
57
  color: #888; /* Grey color for non-selected text */
54
- transition: color 0.3s ease;
55
58
  }
56
59
 
57
60
  .toggle-text-left {
@@ -70,7 +73,7 @@
70
73
  .toggle-input:checked + .toggle-label .toggle-handle {
71
74
  transform: translateX(56px);
72
75
  box-shadow: 0 0 10px rgba(0, 123, 255, 0.8); /* Blue glow effect */
73
- color: #007BFF; /* Blue color for the selected text */
76
+ color: #007bff; /* Blue color for the selected text */
74
77
  }
75
78
 
76
79
  .toggle-input:checked + .toggle-label .toggle-text-left {
@@ -79,4 +82,4 @@
79
82
 
80
83
  .toggle-input:checked + .toggle-label .toggle-text-right {
81
84
  color: #888; /* Grey color for non-selected text */
82
- }
85
+ }
map_app/static/js/main.js CHANGED
@@ -12,16 +12,28 @@ var colorDict = {
12
12
 
13
13
  // A function that creates a cli command from the interface
14
14
  function create_cli_command() {
15
+ const cliPrefix = document.getElementById('cli-prefix');
16
+ cliPrefix.style.opacity = 1;
15
17
  var selected_basins = $('#selected-basins').text();
16
18
  var start_time = document.getElementById('start-time').value.split('T')[0];
17
19
  var end_time = document.getElementById('end-time').value.split('T')[0];
18
- var command = `python -m ngiab_data_cli -i ${selected_basins} --subset --start ${start_time} --end ${end_time} --forcings --realization --run`;
19
- var command_all = `python -m ngiab_data_cli -i ${selected_basins} --start ${start_time} --end ${end_time} --all`;
20
+ var command = `-i ${selected_basins} --subset --start ${start_time} --end ${end_time} --forcings --realization --run`;
21
+ var command_all = `-i ${selected_basins} --start ${start_time} --end ${end_time} --all`;
20
22
  if (selected_basins != "None - get clicking!") {
21
23
  $('#cli-command').text(command);
22
24
  }
23
25
  }
24
26
 
27
+ function updateCommandPrefix(){
28
+ const toggleInput = document.getElementById('runcmd-toggle');
29
+ const cliPrefix = document.getElementById('cli-prefix');
30
+ const uvxText = "uvx --from ngiab_data_preprocess cli"
31
+ const pythonText = "python -m ngiab_data_cli"
32
+ // Set initial handle text based on the default state using data attribute
33
+ cliPrefix.textContent = toggleInput.checked ? pythonText : uvxText;
34
+ }
35
+ document.getElementById("runcmd-toggle").addEventListener('change', updateCommandPrefix);
36
+
25
37
  // These functions are exported by data_processing.js
26
38
  document.getElementById('map').addEventListener('click', create_cli_command);
27
39
  document.getElementById('start-time').addEventListener('change', create_cli_command);
@@ -34,9 +46,9 @@ maplibregl.addProtocol("pmtiles", protocol.tile);
34
46
 
35
47
  // select light-style if the browser is in light mode
36
48
  // select dark-style if the browser is in dark mode
37
- var style = 'static/resources/light-style.json';
49
+ var style = 'https://communityhydrofabric.s3.us-east-1.amazonaws.com/map/styles/light-style.json';
38
50
  if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
39
- style = 'static/resources/dark-style.json';
51
+ style = 'https://communityhydrofabric.s3.us-east-1.amazonaws.com/map/styles/dark-style.json';
40
52
  }
41
53
  var map = new maplibregl.Map({
42
54
  container: 'map', // container id
@@ -48,7 +60,7 @@ function update_map(cat_id, e) {
48
60
  $('#selected-basins').text(cat_id)
49
61
  map.setFilter('selected-catchments', ['any', ['in', 'divide_id', cat_id]]);
50
62
  map.setFilter('upstream-catchments', ['any', ['in', 'divide_id', ""]])
51
-
63
+
52
64
  fetch('/get_upstream_catids', {
53
65
  method: 'POST',
54
66
  headers: { 'Content-Type': 'application/json' },
@@ -57,7 +69,7 @@ function update_map(cat_id, e) {
57
69
  .then(response => response.json())
58
70
  .then(data => {
59
71
  map.setFilter('upstream-catchments', ['any', ['in', 'divide_id', ...data]]);
60
- if (data.length === 0) {
72
+ if (data.length === 0) {
61
73
  new maplibregl.Popup()
62
74
  .setLngLat(e.lngLat)
63
75
  .setHTML('No upstreams')
@@ -66,7 +78,7 @@ function update_map(cat_id, e) {
66
78
  });
67
79
  }
68
80
  map.on('click', 'catchments', (e) => {
69
- cat_id = e.features[0].properties.divide_id;
81
+ cat_id = e.features[0].properties.divide_id;
70
82
  update_map(cat_id, e);
71
83
  });
72
84
 
@@ -101,26 +113,38 @@ map.on('mouseleave', 'conus_gages', () => {
101
113
  });
102
114
 
103
115
  map.on('click', 'conus_gages', (e) => {
104
- // https://waterdata.usgs.gov/monitoring-location/02465000
116
+ // https://waterdata.usgs.gov/monitoring-location/02465000
105
117
  window.open("https://waterdata.usgs.gov/monitoring-location/" + e.features[0].properties.hl_link, '_blank');
106
118
  }
107
119
  );
108
120
  show = false;
109
121
 
110
122
  // TOGGLE BUTTON LOGIC
111
- const toggleInput = document.querySelector('.toggle-input');
112
- const toggleHandle = document.querySelector('.toggle-handle');
113
-
114
- // Set initial text based on the default state
115
- toggleHandle.textContent = toggleInput.checked ? 'AORC' : 'NWM';
123
+ function initializeToggleSwitches() {
124
+ // Find all toggle switches
125
+ const toggleSwitches = document.querySelectorAll('.toggle-switch');
126
+ // Process each toggle switch
127
+ toggleSwitches.forEach(toggleSwitch => {
128
+ const toggleInput = toggleSwitch.querySelector('.toggle-input');
129
+ const toggleHandle = toggleSwitch.querySelector('.toggle-handle');
130
+ const leftText = toggleSwitch.querySelector('.toggle-text-left').textContent;
131
+ const rightText = toggleSwitch.querySelector('.toggle-text-right').textContent;
132
+ // Set initial handle text based on the default state using data attribute
133
+ toggleHandle.textContent = toggleInput.checked ? rightText : leftText;
134
+ // Add event listener
135
+ toggleInput.addEventListener('change', function() {
136
+ setTimeout(() => {
137
+ if (this.checked) {
138
+ toggleHandle.textContent = rightText;
139
+ } else {
140
+ toggleHandle.textContent = leftText;
141
+ }
142
+ }, 180);
143
+ });
144
+ });
145
+ }
146
+ document.addEventListener('DOMContentLoaded', initializeToggleSwitches);
116
147
 
117
- toggleInput.addEventListener('change', function() {
118
- if (this.checked) {
119
- toggleHandle.textContent = 'AORC'; // Update handle text to AORC
120
- } else {
121
- toggleHandle.textContent = 'NWM'; // Update handle text to NWM
122
- }
123
- });
124
148
 
125
149
  show = false;
126
150
  const toggleButton = document.querySelector('#toggle-button');
@@ -135,4 +159,3 @@ toggleButton.addEventListener('click', () => {
135
159
  show = true;
136
160
  }
137
161
  });
138
-
@@ -17,15 +17,23 @@
17
17
 
18
18
  <body>
19
19
  <header>
20
- <h1>Select catchments by clicking!</h1>
20
+ <h1>Select catchments by clicking!</h1>
21
21
  </header>
22
22
 
23
23
  <main>
24
24
  <section id="map-container">
25
- <div id="map"><button id="toggle-button">Show gages</button></div>
26
-
25
+ <div id="map"><button id="toggle-button">Show gages</button></div>
26
+
27
27
  <div class="command-container">
28
28
  <div class="command-header">
29
+ <div class="toggle-switch">
30
+ <input type="checkbox" id="runcmd-toggle" class="toggle-input">
31
+ <label for="runcmd-toggle" class="toggle-label">
32
+ <span class="toggle-text toggle-text-left">UVX</span>
33
+ <span class="toggle-text toggle-text-right">Pip</span>
34
+ <span class="toggle-handle"></span>
35
+ </label>
36
+ </div>
29
37
  <span>Command</span>
30
38
  <button id="copy-to-clip" class="copy-button" aria-label="Copy to clipboard">
31
39
  <svg class="copy-icon" viewBox="0 0 16 16" width="16" height="16">
@@ -35,22 +43,27 @@
35
43
  <span class="copy-text">Copy</span>
36
44
  </button>
37
45
  </div>
38
- <div id="cli-command" class="command-content"></div>
46
+ <div id="command-builder">
47
+ <div id="cli-prefix" class="command-content">uvx --from ngiab_data_preprocess cli </div>
48
+ <div id="cli-command" class="command-content"></div>
49
+ </div>
39
50
  </div>
40
51
  <script>
41
52
  document.getElementById('copy-to-clip').addEventListener('click', async function() {
53
+ const commandPrefix = document.getElementById('cli-prefix').textContent;
42
54
  const commandText = document.getElementById('cli-command').textContent;
55
+ const full_command = commandPrefix + commandText;
43
56
  const button = this;
44
-
57
+
45
58
  try {
46
- await navigator.clipboard.writeText(commandText);
47
-
59
+ await navigator.clipboard.writeText(full_command);
60
+
48
61
  // Update button state
49
62
  button.classList.add('copied');
50
63
  const copyText = button.querySelector('.copy-text');
51
64
  const originalText = copyText.textContent;
52
65
  copyText.textContent = 'Copied!';
53
-
66
+
54
67
  // Reset button state after 2 seconds
55
68
  setTimeout(() => {
56
69
  button.classList.remove('copied');
@@ -62,7 +75,7 @@
62
75
  });
63
76
  </script>
64
77
  <h2>For selection by gage id please use the cli.</h2>
65
- </section>
78
+ </section>
66
79
  <section id="basins-container">
67
80
  <h2>Selected Basins</h2>
68
81
  <div id="selected-basins">None - get clicking!</div>
map_app/views.py CHANGED
@@ -3,22 +3,22 @@ import logging
3
3
  from datetime import datetime
4
4
  from pathlib import Path
5
5
 
6
+ import geopandas as gpd
6
7
  from data_processing.create_realization import create_realization
8
+ from data_processing.dataset_utils import save_and_clip_dataset
9
+ from data_processing.datasets import load_aorc_zarr, load_v3_retrospective_zarr
7
10
  from data_processing.file_paths import file_paths
8
11
  from data_processing.forcings import create_forcings
9
- from data_processing.datasets import load_aorc_zarr, load_v3_retrospective_zarr
10
- from data_processing.dataset_utils import save_and_clip_dataset
11
12
  from data_processing.graph_utils import get_upstream_cats, get_upstream_ids
12
13
  from data_processing.subset import subset
13
14
  from flask import Blueprint, jsonify, render_template, request
14
15
 
15
- import geopandas as gpd
16
-
17
16
  main = Blueprint("main", __name__)
18
17
  intra_module_db = {}
19
18
 
20
19
  logger = logging.getLogger(__name__)
21
20
 
21
+
22
22
  @main.route("/")
23
23
  def index():
24
24
  return render_template("index.html")
@@ -86,8 +86,8 @@ def get_forcings():
86
86
  app = intra_module_db["app"]
87
87
  debug_enabled = app.debug
88
88
  app.debug = False
89
- logger.info(f"get_forcings() disabled debug mode at {datetime.now()}")
90
- print(f"forcing_dir: {output_folder}")
89
+ logger.debug(f"get_forcings() disabled debug mode at {datetime.now()}")
90
+ logger.debug(f"forcing_dir: {output_folder}")
91
91
  try:
92
92
  if data_source == "aorc":
93
93
  data = load_aorc_zarr(start_time.year, end_time.year)
@@ -138,5 +138,5 @@ def get_logs():
138
138
  if len(reversed_lines) > 100:
139
139
  break
140
140
  return jsonify({"logs": reversed_lines}), 200
141
- except Exception as e:
141
+ except Exception:
142
142
  return jsonify({"error": "unable to fetch logs"})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngiab_data_preprocess
3
- Version: 4.2.0
3
+ Version: 4.2.2
4
4
  Summary: Graphical Tools for creating Next Gen Water model input data.
5
5
  Author-email: Josh Cunningham <jcunningham8@ua.edu>
6
6
  Project-URL: Homepage, https://github.com/CIROH-UA/NGIAB_data_preprocess
@@ -23,8 +23,6 @@ Requires-Dist: zarr==2.17.1
23
23
  Requires-Dist: netCDF4>=1.6.5
24
24
  Requires-Dist: dask==2024.4.1
25
25
  Requires-Dist: dask[distributed]==2024.4.1
26
- Requires-Dist: black==24.3.0
27
- Requires-Dist: isort==5.13.2
28
26
  Requires-Dist: h5netcdf==1.3.0
29
27
  Requires-Dist: exactextract==0.2.0
30
28
  Requires-Dist: numpy>=1.26.4
@@ -1,12 +1,12 @@
1
- data_processing/create_realization.py,sha256=AxUDVSORjwd6IAImZpgDr8GRHKSUQF8emQi1ikfIno4,14899
1
+ data_processing/create_realization.py,sha256=BqGtJSfl-XlsCQOIxonQcZKxLddz_LE18x6At4qCiRo,14948
2
2
  data_processing/dataset_utils.py,sha256=4qmRmK3qMWPkiWZHXhXv3c-ISbtOwr7QhciEl2ok6Ao,7314
3
3
  data_processing/datasets.py,sha256=BB_X0IvGnUrjBmj-wryn6-Nv5cd0Lje3zly3p896eU4,4822
4
4
  data_processing/file_paths.py,sha256=Cp3BxbO6sD50464ciTshjb3Z0vTvL0ZeSbOJgNdOqQ0,4698
5
- data_processing/forcings.py,sha256=6Q9fSXa67OrXg_r9li0K9widsclN2DQUp1-oUH2tZwo,19208
6
- data_processing/gpkg_utils.py,sha256=j-j6TkCwlkOzM5ATMHi44raYS-xrJMzk5V0XQZ_0dzQ,20220
5
+ data_processing/forcings.py,sha256=bHVXEUpSTzw3iBdw6_jww0Wk_HksZseWdFJ0oF-Ri-E,18910
6
+ data_processing/gpkg_utils.py,sha256=fr0X62HawnSXzWRHcC_9aFrnoKv5atz4XkalydxCSko,20538
7
7
  data_processing/graph_utils.py,sha256=I9IFkU08SkXb8pfVASTvkm7T8BYt-92CaNj7TV6wJFE,8244
8
8
  data_processing/s3fs_utils.py,sha256=WoqqwxkHpv0Qq4I5f5-gUZBCFtVQ68ehXbdOjWRKTDQ,2752
9
- data_processing/subset.py,sha256=GbvfAaSJTfEvYOAZ6K0OgFA81xG_Y5UxiGDxukxO9gE,2558
9
+ data_processing/subset.py,sha256=ns-WIHzshi74CFetmGsYvd72QgNtQFwl6Avc9rIYpf4,2604
10
10
  data_sources/cfe-nowpm-realization-template.json,sha256=8an6q1drWD8wU1ocvdPab-GvZDvlQ-0di_-NommH3QI,3528
11
11
  data_sources/cfe-template.ini,sha256=6e5-usqjWtm3MWVvtm8CTeZTJJMxO1ZswkOXq0L9mnc,2033
12
12
  data_sources/em-catchment-template.yml,sha256=M08ixazEUHYI2PNavtI0xPZeSzcQ9bg2g0XzNT-8_u4,292
@@ -20,25 +20,23 @@ data_sources/template.sql,sha256=ZnFqAqleEq9wgmAhNO90Wue_L9k0JAn8KF99DYtcxgs,104
20
20
  data_sources/triggers.sql,sha256=G0d_175eNsamKAFhsbphPATvzMPuPL_iCleIhlToduQ,14906
21
21
  map_app/__init__.py,sha256=OarJao9X98kcbLyiwewN4ObWNAYkKDichcxbuWywTsA,818
22
22
  map_app/__main__.py,sha256=D9uuAcsOUyfgYqGXQwsmNLo3n3BQ8pnziCAQWQnV4RU,1617
23
- map_app/views.py,sha256=L4ng9lqpLuWglTxk3iZ2NzfP1ASGpPwQTojKN2d8YzE,5119
23
+ map_app/views.py,sha256=0T-tvAzyfD1ttEQsZ84iAc2ELVN_KS056_YxiyHQ_DE,5122
24
24
  map_app/static/css/console.css,sha256=xN6G2MMFyKc9YW9HEVpUUTUjx2o2nokBR4nCX5c18UM,803
25
- map_app/static/css/main.css,sha256=Vm_I4HnFDa2IvpWeuhN72DxtOOHHN2LUZvN0REQwZyU,6050
26
- map_app/static/css/toggle.css,sha256=cWsWqeuzQVc0b55kZ8alHaMWzoAJwaklbNWuR-PyN38,1884
25
+ map_app/static/css/main.css,sha256=UkctdgBijejzpjhLVwOBx2LxdPAY625_yTIe90fKpv0,6188
26
+ map_app/static/css/toggle.css,sha256=Ep6tXT7gCrPRRITuEMpXyisuiTQgiLIEKFFTWRmC82o,1913
27
27
  map_app/static/js/console.js,sha256=BnG0pED5B9d563sLWshDNt_q-SyoTY48sETvVoOVJkU,1377
28
28
  map_app/static/js/data_processing.js,sha256=X6NSuggOGNIJUF-LEyGGYJjtiA5J29xmkXgFFmfBw18,6711
29
- map_app/static/js/main.js,sha256=oLO2mwfVpjyabNXTcCh3nvDbz3XlOJejS610rSMvYKM,5588
30
- map_app/static/resources/dark-style.json,sha256=iD9RXryjL-NLbJTbODoAkmx3jhXCUqTJ7lXMCxzqsoY,418578
31
- map_app/static/resources/light-style.json,sha256=DaE52qKpAkjiWSKY_z7LxreqA2rW4ZyQkhUWE5VIo3Y,418612
29
+ map_app/static/js/main.js,sha256=dM0fCzNg-nV3wEqZFQ_wEam0Sm8RqHOv2GgRYg97pQQ,6875
32
30
  map_app/static/resources/loading.gif,sha256=ggdkZf1AD7rSwIpSJwfiIqANgmVV1WHlxGuKxQKv7uY,72191
33
31
  map_app/static/resources/screenshot.jpg,sha256=Ia358aX-OHM9BP4B8lX05cLnguF2fHUIimno9bnFLYw,253730
34
- map_app/templates/index.html,sha256=ITRzQEYn15sFN4qRACjaNj5muhalOeP9n_IwcdsIlUs,6631
32
+ map_app/templates/index.html,sha256=82zRdoPar5qfgdwFiVkuXeIQC4okt9iDgCPeNxKdX9I,7403
35
33
  ngiab_data_cli/__main__.py,sha256=V-g0dwa000e5Qye7PBMTtHTK7Cl7as3JS0UoAR0QrZ4,10503
36
34
  ngiab_data_cli/arguments.py,sha256=7ptImy8tLM1XvjfDr13tZszkjGVtenXo0KqllJeE3Mw,4372
37
35
  ngiab_data_cli/custom_logging.py,sha256=iS2XozaxudcxQj17qAsrCgbVK9LJAYAPmarJuVWJo1k,1280
38
36
  ngiab_data_cli/forcing_cli.py,sha256=lkcqWDk5H8IPyGv0DwLIZMQldqTUXpfwSX0C_RIuIJ8,3890
39
- ngiab_data_preprocess-4.2.0.dist-info/licenses/LICENSE,sha256=6dMSprwwnsRzEm02mEDbKHD9dUbL8bPIt9Vhrhb0Ulk,1081
40
- ngiab_data_preprocess-4.2.0.dist-info/METADATA,sha256=Y2NVmd92S38QMwKXEkLvLKyWQ2IGy25okHV8sDy6c2c,10310
41
- ngiab_data_preprocess-4.2.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
42
- ngiab_data_preprocess-4.2.0.dist-info/entry_points.txt,sha256=spwlhKEJ3ZnNETQsJGeTjD7Vwy8O_zGHb9GdX8ACCtw,128
43
- ngiab_data_preprocess-4.2.0.dist-info/top_level.txt,sha256=CjhYAUZrdveR2fOK6rxffU09VIN2IuPD7hk4V3l3pV0,52
44
- ngiab_data_preprocess-4.2.0.dist-info/RECORD,,
37
+ ngiab_data_preprocess-4.2.2.dist-info/licenses/LICENSE,sha256=6dMSprwwnsRzEm02mEDbKHD9dUbL8bPIt9Vhrhb0Ulk,1081
38
+ ngiab_data_preprocess-4.2.2.dist-info/METADATA,sha256=qzh_j7XnKUvF6Zq4sx3idNEp1MneIpAL8ci06lfZDLw,10252
39
+ ngiab_data_preprocess-4.2.2.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
40
+ ngiab_data_preprocess-4.2.2.dist-info/entry_points.txt,sha256=spwlhKEJ3ZnNETQsJGeTjD7Vwy8O_zGHb9GdX8ACCtw,128
41
+ ngiab_data_preprocess-4.2.2.dist-info/top_level.txt,sha256=CjhYAUZrdveR2fOK6rxffU09VIN2IuPD7hk4V3l3pV0,52
42
+ ngiab_data_preprocess-4.2.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5