windmapper 2.2.1__tar.gz → 2.2.3__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.
@@ -0,0 +1,26 @@
1
+ __pycache__
2
+ *.tif
3
+ *.vrt
4
+ *.asc
5
+ *.prj
6
+ WindNinja_cli
7
+ .python-version
8
+ .idea/
9
+ docs/_build/
10
+
11
+ *.egg-info
12
+
13
+ spack-deploy/*
14
+ .spack-env/*
15
+ ._venv/*
16
+ venv
17
+
18
+
19
+ dist/*
20
+
21
+ spack.lock
22
+ /implementation/._view/*
23
+ /implementation/.spack-env/*
24
+ /implementation/view/*
25
+ /implementation/windmapper_config
26
+ /implementation/spack.lock
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: windmapper
3
- Version: 2.2.1
3
+ Version: 2.2.3
4
4
  Summary: Windfield library generation
5
5
  Author: Chris Marsh
6
6
  Project-URL: Homepage, https://github.com/Chrismarsh/Windmapper
@@ -33,4 +33,9 @@ To build Windninja, ensure gdal, boost, and mpi system libraries are installed a
33
33
  Spack can also be used to install windmapper -- please see documentation below.
34
34
 
35
35
  # Documentation
36
- Documentation and full instructions on use can be found [here](https://windmapper.readthedocs.io)
36
+ Documentation and full instructions on use can be found [here](https://windmapper.readthedocs.io)
37
+
38
+ # Implimentation
39
+
40
+ The directory `implementation/` contains a jupyter notebook with an example implimentation of the code. It is not
41
+ vectorized to aid in readability. However, this makes it very very slow!
@@ -15,4 +15,9 @@ To build Windninja, ensure gdal, boost, and mpi system libraries are installed a
15
15
  Spack can also be used to install windmapper -- please see documentation below.
16
16
 
17
17
  # Documentation
18
- Documentation and full instructions on use can be found [here](https://windmapper.readthedocs.io)
18
+ Documentation and full instructions on use can be found [here](https://windmapper.readthedocs.io)
19
+
20
+ # Implimentation
21
+
22
+ The directory `implementation/` contains a jupyter notebook with an example implimentation of the code. It is not
23
+ vectorized to aid in readability. However, this makes it very very slow!
@@ -1,9 +1,9 @@
1
1
  set -e
2
2
  . ~/Documents/science/code/spack/share/spack/setup-env.sh
3
3
  #setup build env
4
- spack env create -d spack-deploy spack-deploy.yaml
4
+ #spack env create -d spack-deploy spack-deploy.yaml
5
5
  spack env activate spack-deploy
6
- spack install
6
+ #spack install
7
7
 
8
8
 
9
9
  #build current version
@@ -14,4 +14,5 @@ twine upload dist/* --skip-existing
14
14
  #clean up
15
15
  spack env deactivate
16
16
  rm -rf spack-deploy
17
- rm -rf dist
17
+ rm -rf dist
18
+
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
4
4
 
5
5
  [project]
6
6
  name = "windmapper"
7
- version = "2.2.1"
7
+ version = "2.2.3"
8
8
  authors = [
9
9
  {name="Chris Marsh"}
10
10
  ]
@@ -27,7 +27,8 @@ dependencies = [
27
27
  Homepage = "https://github.com/Chrismarsh/Windmapper"
28
28
 
29
29
  [tool.scikit-build]
30
- sdist.exclude = ["examples", "docs", "_config.yml", "dist"]
30
+ sdist.exclude = ["examples", "docs", "_config.yml", "dist", "spack-deploy", "venv", "implementation"]
31
31
 
32
32
  [project.scripts]
33
33
  windmapper = "windmapper:main"
34
+
@@ -0,0 +1,3 @@
1
+ spack:
2
+ specs: [py-windmapper]
3
+ view: venv
@@ -0,0 +1,2 @@
1
+ from .windmapper_utls import *
2
+ from .windmapper_cli import *
@@ -29,7 +29,7 @@ import itertools
29
29
  from tqdm import tqdm
30
30
  import cloudpickle
31
31
  from mpi4py import MPI
32
- import windmapper_utls as wm
32
+ from . import windmapper_utls as wm
33
33
 
34
34
 
35
35
 
@@ -60,17 +60,19 @@ def main():
60
60
 
61
61
  # path to Wind Ninja executable
62
62
 
63
- # default path assumes we are running out of pip or we have a symlink @ ./bin/WindNinja_cli
64
- wn_exe = os.path.join(
65
- os.path.dirname(
66
- os.path.abspath(__file__)), 'WindNinja_cli')
63
+ # default path assumes that WN is on $PATH
64
+ wn_exe = shutil.which('WindNinja_cli')
67
65
 
68
66
  if hasattr(X, 'wn_exe'):
69
67
  wn_exe = X.wn_exe
70
68
 
71
69
  if not os.path.exists(wn_exe):
72
- print('ERROR: Invalid path for WindNinja_cli. Consider specifying a `wn_exe` config option or confirm it is correct.')
73
- print(f'Path = {wn_exe}')
70
+ if hasattr(X, 'wn_exe'):
71
+ print('ERROR: Path to WindNinja_cli not found. Confirm `wn_exe` config option is correct.')
72
+ print(f'Path = {wn_exe}')
73
+ else:
74
+ print(
75
+ 'ERROR: WindNinja_cli not found on $PATH. Ensure it is is or Consider specifying a `wn_exe` config option')
74
76
  exit(-1)
75
77
 
76
78
  MPI_exec_str = None
@@ -548,6 +550,7 @@ write_farsite_atm = false """
548
550
  # absolutely make sure there are no missing data. From the cut above can sometimes be missing 1px along the edge
549
551
  exec_str = '%sgdal_fillnodata.py %s %s'
550
552
  com_string = exec_str % (gdal_prefix, fic_tmp+'.tmp.tif', fic_tmp)
553
+ print(com_string)
551
554
  subprocess.check_call([com_string], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
552
555
 
553
556
  os.remove(fic_tmp+'.tmp.tif')
@@ -606,13 +609,16 @@ write_farsite_atm = false """
606
609
  # Because the above parallel windmap generation produces small chunks of the domain with partial overlap, they need to merged into a single tif
607
610
  # that removes this overlap
608
611
  nwind = np.arange(0, 360., delta_wind)
612
+ rio_merge_path = os.path.join(os.path.join(os.path.dirname(wm.__file__),
613
+ 'rio_merge.py'))
614
+
609
615
  with tqdm(total=len(nwind)) as pbar:
610
616
  for wdir in nwind:
611
617
  for var in list_tif_2_vrt:
612
618
 
613
619
  name_tif = user_output_dir + name_utm + '_' + str(int(wdir)) + '_' + var
614
620
  cmd = "find " + user_output_dir[0:-1] + " -type f -name '*_" + str(int(wdir)) + "_10_" + str(
615
- res_wind) + "m_" + var + "*.tif' -exec rio_merge.py " + name_tif + '.tmp.tif' + " {} +"
621
+ res_wind) + "m_" + var + "*.tif' -exec " + sys.executable + " " + rio_merge_path + " " + name_tif + '.tmp.tif' + " {} +"
616
622
  subprocess.check_call([cmd], stdout=subprocess.PIPE,
617
623
  shell=True)
618
624
 
@@ -66,7 +66,7 @@ def call_WN_1dir(WINDNINJA_DATA, gdal_prefix, user_output_dir, fic_config_WN, li
66
66
  exec_cmd = wn_exe + ' ' + \
67
67
  fic_config_WN + ' --elevation_file ' + fic_dem_in + ' --mesh_resolution ' + str(
68
68
  res_wind) + ' --input_direction ' + str(int(wdir)) + ' --output_path ' + dir_tmp
69
-
69
+ print(exec_cmd)
70
70
  try:
71
71
  os.environ["WINDNINJA_DATA"] = WINDNINJA_DATA
72
72
  out = subprocess.check_output([exec_cmd],
@@ -41,9 +41,7 @@ def copy_mean(merged_data, new_data, merged_mask, new_mask, index, **kwargs):
41
41
  # dst, src, <...>
42
42
  np.copyto(merged_data, m.data, where=mask, casting="unsafe")
43
43
 
44
-
45
-
46
- if __name__ == '__main__':
44
+ def main():
47
45
  files = []
48
46
 
49
47
  outfile = sys.argv[1]
@@ -63,3 +61,6 @@ if __name__ == '__main__':
63
61
  with rio.open(outfile, "w", **out_meta) as dest1:
64
62
  dest1.write(dest)
65
63
 
64
+ if __name__ == '__main__':
65
+ main()
66
+
@@ -1,17 +0,0 @@
1
- __pycache__
2
- *.tif
3
- *.vrt
4
- *.asc
5
- *.prj
6
- WindNinja_cli
7
- .python-version
8
- .idea/
9
- docs/_build/
10
- build/
11
- MANIFEST
12
- dist/
13
- *.egg-info
14
- _skbuild/
15
- /spack-deploy/*
16
- /dist/*
17
- /implimentation/*
@@ -1,10 +0,0 @@
1
- graft pysrc
2
- graft scripts
3
-
4
- include .gitignore
5
- include CMakeLists.txt
6
- include LICENSE
7
- include README.md
8
- include windmapper.py
9
- include pyproject.toml
10
- include setup.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes