pyopenrivercam 0.9.0__py3-none-any.whl → 0.9.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyopenrivercam
3
- Version: 0.9.0
3
+ Version: 0.9.2
4
4
  Summary: pyorc: free and open-source image-based surface velocity and discharge.
5
5
  Author-email: Hessel Winsemius <winsemius@rainbowsensing.com>
6
6
  Requires-Python: >=3.9
@@ -28,9 +28,12 @@ Requires-Dist: geopandas
28
28
  Requires-Dist: matplotlib
29
29
  Requires-Dist: netCDF4
30
30
  Requires-Dist: numba>0.56
31
- Requires-Dist: numpy>2
31
+ Requires-Dist: numpy==1.26.4; python_version == '3.9'
32
+ Requires-Dist: numpy>=2; python_version >= '3.10'
32
33
  Requires-Dist: opencv-python
33
34
  Requires-Dist: packaging; platform_machine == 'armv7l'
35
+ Requires-Dist: pillow==9.5.0; python_version == '3.9'
36
+ Requires-Dist: pillow; python_version >= '3.10'
34
37
  Requires-Dist: pip
35
38
  Requires-Dist: pyproj
36
39
  Requires-Dist: pythran; platform_machine == 'armv7l'
@@ -1,11 +1,11 @@
1
- pyorc/__init__.py,sha256=yPY8lllCcJb3rKv4-9O6b393ZSX86dAiOSRqAbEBmaQ,523
1
+ pyorc/__init__.py,sha256=UQuU9xy-pxY7XonoYJqzQU1RinDVb6mgc3FAsaWrA0g,523
2
2
  pyorc/const.py,sha256=Ia0KRkm-E1lJk4NxQVPDIfN38EBB7BKvxmwIHJrGPUY,2597
3
3
  pyorc/cv.py,sha256=t2ZR4eyGbiwlIaGHysOheWdaDQuqpWLKjcTiAUzWAR0,50261
4
4
  pyorc/helpers.py,sha256=jed0YyywnpvsZS-8mcA7Lfzn9np1MTlmVLE_PDn2QY0,30454
5
5
  pyorc/plot_helpers.py,sha256=gLKslspsF_Z4jib5jkBv2wRjKnHTbuRFgkp_PCmv-uU,1803
6
6
  pyorc/project.py,sha256=CGKfICkQEpFRmh_ZeDEfbQ-wefJt7teWJd6B5IPF038,7747
7
7
  pyorc/pyorc.sh,sha256=-xOSUNnMAwVbdNkjKNKMZMaBljWsGLhadG-j0DNlJP4,5
8
- pyorc/sample_data.py,sha256=_yxtjhHc1sjHXZJRWQgBNOOn0Qqs2A5CavyFOQX5p8U,3241
8
+ pyorc/sample_data.py,sha256=AhQgYozpbMcSxtNyi6WfHSKHeSRgDQqFhLO0-VrQKiU,3171
9
9
  pyorc/api/__init__.py,sha256=k2OQQH4NrtXTuVm23d0g_SX6H5DhnKC9_kDyzJ4dWdk,428
10
10
  pyorc/api/cameraconfig.py,sha256=NP9F7LhPO3aO6FRWkrGl6XpX8O3K59zfTtaYR3Kujqw,65419
11
11
  pyorc/api/cross_section.py,sha256=MH0AEw5K1Kc1ClZeQRBUYkShZYVk41fshLn6GzCZAas,65212
@@ -26,8 +26,8 @@ pyorc/service/camera_config.py,sha256=OsRLpe5jd-lu6HT4Vx5wEg554CMS-IKz-q62ir4VbP
26
26
  pyorc/service/velocimetry.py,sha256=bPI1OdN_fi0gZES08mb7yqCS_4I-lKSZ2JvWSGTRD1E,34434
27
27
  pyorc/velocimetry/__init__.py,sha256=5oShoMocCalcCZuIsBqlZlqQuKJgDDBUvXQIo-uqFPA,88
28
28
  pyorc/velocimetry/ffpiv.py,sha256=92XDgzCW4mEZ5ow82zV0APOhfDc1OVftBjKqYdw1zzc,17494
29
- pyopenrivercam-0.9.0.dist-info/entry_points.txt,sha256=Cv_WI2Y6QLnPiNCXGli0gS4WAOAeMoprha1rAR3vdRE,44
30
- pyopenrivercam-0.9.0.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
31
- pyopenrivercam-0.9.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
32
- pyopenrivercam-0.9.0.dist-info/METADATA,sha256=d2rvFtUmIHAhMBruxLKJ8qEukxEl3y4fZWzAbeeNZ0w,12383
33
- pyopenrivercam-0.9.0.dist-info/RECORD,,
29
+ pyopenrivercam-0.9.2.dist-info/entry_points.txt,sha256=Cv_WI2Y6QLnPiNCXGli0gS4WAOAeMoprha1rAR3vdRE,44
30
+ pyopenrivercam-0.9.2.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
31
+ pyopenrivercam-0.9.2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
32
+ pyopenrivercam-0.9.2.dist-info/METADATA,sha256=LjzGioSQjEn7ku6f8v6N0jti7SiJvMw7Le1HQwboeas,12566
33
+ pyopenrivercam-0.9.2.dist-info/RECORD,,
pyorc/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """pyorc: free and open-source image-based surface velocity and discharge."""
2
2
 
3
- __version__ = "0.9.0"
3
+ __version__ = "0.9.2"
4
4
 
5
5
  from .api import CameraConfig, CrossSection, Frames, Transect, Velocimetry, Video, get_camera_config, load_camera_config # noqa
6
6
  from .project import * # noqa
pyorc/sample_data.py CHANGED
@@ -4,78 +4,84 @@ import os
4
4
  import time
5
5
  import zipfile
6
6
 
7
+ import platformdirs
8
+ import requests
7
9
 
8
- def get_hommerich_dataset():
9
- """Retrieve and cache sample dataset of Sheaf river."""
10
+ cache_dir = platformdirs.user_cache_dir("pyorc")
11
+
12
+
13
+ def zenodo_pooch(record_id, cache_name):
14
+ """Retrieve files from Zenodo record."""
10
15
  try:
11
16
  import pooch
12
17
  except ImportError:
13
18
  raise ImportError("This function needs pooch. Install pyorc with pip install pyopenrivercam[extra]")
19
+ r = requests.get(
20
+ f"https://zenodo.org/api/records/{record_id}",
21
+ timeout=30,
22
+ # headers=headers
23
+ )
24
+ if r.status_code != 200:
25
+ raise RuntimeError(f"Failed to fetch metadata for record {record_id}. {r.status_code} {r.text}")
26
+ meta = r.json()
27
+ urls = {f["key"]: f["links"]["self"] for f in meta["files"]}
14
28
 
29
+ return pooch.create(
30
+ path=pooch.os_cache(cache_name),
31
+ base_url="",
32
+ urls=urls,
33
+ registry={name: None for name in urls},
34
+ )
35
+
36
+
37
+ def get_hommerich_dataset():
38
+ """Retrieve and cache sample dataset of Sheaf river."""
15
39
  # Define the DOI link
16
40
  filename = "20241010_081717.mp4"
17
- base_url = "https://zenodo.org/records/15002591/files"
18
- url = base_url + "/" + filename
19
- print(f"Retrieving or providing cached version of dataset from {url}")
20
- # Create a Pooch registry to manage downloads
21
- registry = pooch.create(
22
- # Define the cache directory
23
- path=pooch.os_cache("pyorc"),
24
- # Define the base URL for fetching data
25
- base_url=base_url,
26
- # Define the registry with the file we're expecting to download
27
- registry={filename: None},
28
- )
41
+ file_path = os.path.join(cache_dir, filename)
29
42
  # Fetch the dataset
30
- for attempt in range(5):
31
- try:
32
- file_path = registry.fetch(filename, progressbar=True)
33
- break
34
- except Exception as e:
35
- if attempt == 4:
36
- raise f"Download failed with error: {e}."
37
- else:
38
- print(f"Download failed with error: {e}. Retrying...")
39
- time.sleep(1)
40
- print(f"Hommerich video is available in {file_path}")
43
+ if not os.path.exists(file_path):
44
+ for attempt in range(5):
45
+ registry = zenodo_pooch(
46
+ record_id=15002591,
47
+ cache_name="pyorc",
48
+ )
49
+ try:
50
+ file_path = registry.fetch(filename, progressbar=True)
51
+ break
52
+ except Exception as e:
53
+ if attempt == 4:
54
+ raise f"Download failed with error: {e}."
55
+ else:
56
+ print(f"Download failed with error: {e}. Retrying...")
57
+ time.sleep(1)
58
+ print(f"Hommerich video is available in {file_path}")
41
59
  return file_path
42
60
 
43
61
 
44
62
  def get_hommerich_pyorc_zip():
45
63
  """Retrieve and cache sample dataset of Sheaf river."""
46
- try:
47
- import pooch
48
- except ImportError:
49
- raise ImportError("This function needs pooch. Install pyorc with pip install pyopenrivercam[extra]")
50
-
51
- # Define the DOI link
64
+ #
65
+ # # Define the DOI link
52
66
  filename = "hommerich_20241010_081717_pyorc_data.zip.zip"
53
- base_url = "https://zenodo.org/records/15002591/files"
54
- url = base_url + "/" + filename
55
- print(f"Retrieving or providing cached version of dataset from {url}")
56
- # Create a Pooch registry to manage downloads
57
- registry = pooch.create(
58
- # Define the cache directory
59
- path=pooch.os_cache("pyorc"),
60
- # Define the base URL for fetching data
61
- base_url=base_url,
62
- # Define the registry with the file we're expecting to download
63
- registry={filename: None},
64
- )
65
- # Fetch the dataset
66
- file_path = registry.fetch(filename, progressbar=True)
67
+ file_path = os.path.join(cache_dir, filename)
67
68
  # Fetch the dataset
68
- for attempt in range(5):
69
- try:
70
- file_path = registry.fetch(filename, progressbar=True)
71
- break
72
- except Exception as e:
73
- if attempt == 4:
74
- raise f"Download failed with error: {e}."
75
- else:
76
- print(f"Download failed with error: {e}. Retrying...")
77
- time.sleep(1)
78
- print(f"Hommerich video is available in {file_path}")
69
+ if not os.path.exists(file_path):
70
+ for attempt in range(5):
71
+ registry = zenodo_pooch(
72
+ record_id=15002591,
73
+ cache_name="pyorc",
74
+ )
75
+ try:
76
+ file_path = registry.fetch(filename, progressbar=True)
77
+ break
78
+ except Exception as e:
79
+ if attempt == 4:
80
+ raise f"Download failed with error: {e}."
81
+ else:
82
+ print(f"Download failed with error: {e}. Retrying...")
83
+ time.sleep(1)
84
+ print(f"Hommerich video is available in {file_path}")
79
85
  return file_path
80
86
 
81
87