windmapper 2.2.1__tar.gz → 2.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.1
2
2
  Name: windmapper
3
- Version: 2.2.1
3
+ Version: 2.2.2
4
4
  Summary: Windfield library generation
5
5
  Author: Chris Marsh
6
6
  Project-URL: Homepage, https://github.com/Chrismarsh/Windmapper
@@ -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.2"
8
8
  authors = [
9
9
  {name="Chris Marsh"}
10
10
  ]
@@ -31,3 +31,4 @@ sdist.exclude = ["examples", "docs", "_config.yml", "dist"]
31
31
 
32
32
  [project.scripts]
33
33
  windmapper = "windmapper:main"
34
+
@@ -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
@@ -606,13 +608,16 @@ write_farsite_atm = false """
606
608
  # Because the above parallel windmap generation produces small chunks of the domain with partial overlap, they need to merged into a single tif
607
609
  # that removes this overlap
608
610
  nwind = np.arange(0, 360., delta_wind)
611
+ rio_merge_path = os.path.join(os.path.join(os.path.dirname(wm.__file__),
612
+ 'rio_merge.py'))
613
+
609
614
  with tqdm(total=len(nwind)) as pbar:
610
615
  for wdir in nwind:
611
616
  for var in list_tif_2_vrt:
612
617
 
613
618
  name_tif = user_output_dir + name_utm + '_' + str(int(wdir)) + '_' + var
614
619
  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' + " {} +"
620
+ res_wind) + "m_" + var + "*.tif' -exec " + sys.executable + " " + rio_merge_path + " " + name_tif + '.tmp.tif' + " {} +"
616
621
  subprocess.check_call([cmd], stdout=subprocess.PIPE,
617
622
  shell=True)
618
623
 
@@ -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
+
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes