foxes 1.2.3__py3-none-any.whl → 1.2.4__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.

Potentially problematic release.


This version of foxes might be problematic. Click here for more details.

foxes/config/config.py CHANGED
@@ -1,5 +1,6 @@
1
1
  import numpy as np
2
2
  from pathlib import Path
3
+ from sys import version_info
3
4
 
4
5
  from foxes.utils import Dict, import_module
5
6
  import foxes.constants as FC
@@ -26,6 +27,10 @@ class Config(Dict):
26
27
  name="config",
27
28
  )
28
29
 
30
+ # special treat for Python 3.8:
31
+ if version_info[0] == 3 and version_info[1] == 8:
32
+ self["nc_engine"] = None
33
+
29
34
  @property
30
35
  def dtype_double(self):
31
36
  """
@@ -119,8 +124,10 @@ class Config(Dict):
119
124
  The NetCDF engine
120
125
 
121
126
  """
122
- import_module(self[FC.NC_ENGINE])
123
- return self[FC.NC_ENGINE]
127
+ nce = self[FC.NC_ENGINE]
128
+ if nce is not None:
129
+ import_module(nce)
130
+ return nce
124
131
 
125
132
 
126
133
  config = Config()
foxes/utils/__init__.py CHANGED
@@ -17,6 +17,7 @@ from .regularize import sqrt_reg
17
17
  from .tab_files import read_tab_file
18
18
  from .random_xy import random_xy_square
19
19
  from .dev_utils import print_mem
20
+ from .wrg_utils import ReaderWRG
20
21
 
21
22
  from . import two_circles
22
23
  from . import abl
@@ -0,0 +1,79 @@
1
+ import pandas as pd
2
+ from pathlib import Path
3
+
4
+
5
+ class ReaderWRG:
6
+ """
7
+ A reader for WRG files
8
+
9
+ Attributes
10
+ ----------
11
+ fpath: pathlib.Path
12
+ Path to the wrg file
13
+
14
+ """
15
+
16
+ def __init__(self, fpath):
17
+ """
18
+ Constructor
19
+
20
+ Parameters
21
+ ----------
22
+ fpath: str
23
+ Path to the wrg file
24
+ """
25
+ self.fpath = Path(fpath)
26
+ self._prepare()
27
+
28
+ def _prepare(self):
29
+ # read the first two lines
30
+ with open(self.fpath, "r") as fstream:
31
+ self._nx, self._ny, self._utmx0, self._utmy0, self._res = (
32
+ fstream.readline().split()
33
+ )
34
+ second_line = fstream.readline().split()
35
+ n_cols = len(second_line)
36
+ self._n_sectors = int(second_line[8])
37
+ self._nx, self._ny, self._utmx0, self._utmy0, self._res = (
38
+ int(self._nx),
39
+ int(self._ny),
40
+ float(self._utmx0),
41
+ float(self._utmy0),
42
+ int(self._res),
43
+ )
44
+
45
+ cols_sel = lambda name, secs: [f"{name}_{i}" for i in range(secs)]
46
+
47
+ cols = [0] * (8 + 3 * self._n_sectors)
48
+ cols[0] = "utmx"
49
+ cols[1] = "utmy"
50
+ cols[2] = "z"
51
+ cols[3] = "h"
52
+ cols[4] = "A"
53
+ cols[5] = "K"
54
+ cols[6] = "pw"
55
+ cols[7] = "n_sectors"
56
+ cols[8::3] = cols_sel("fs", self._n_sectors)
57
+ cols[9::3] = cols_sel("As", self._n_sectors)
58
+ cols[10::3] = cols_sel("Ks", self._n_sectors)
59
+
60
+ self._data = pd.read_csv(
61
+ self.fpath, names=cols, skiprows=1, sep="\s+", usecols=range(1, n_cols)
62
+ )
63
+
64
+ self._data[cols_sel("fs", self._n_sectors)] /= 10
65
+ self._data[cols_sel("As", self._n_sectors)] /= 10
66
+ self._data[cols_sel("Ks", self._n_sectors)] /= 100
67
+
68
+ @property
69
+ def data(self):
70
+ """
71
+ The WRG data
72
+
73
+ Returns
74
+ -------
75
+ df: pandas.DataFrame
76
+ The WRG data
77
+
78
+ """
79
+ return self._data
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foxes
3
- Version: 1.2.3
3
+ Version: 1.2.4
4
4
  Summary: Farm Optimization and eXtended yield Evaluation Software
5
5
  Author: Jonas Schulte
6
6
  Maintainer: Jonas Schulte
@@ -45,7 +45,7 @@ foxes/algorithms/sequential/models/__init__.py,sha256=OneaRLxMPzVWLKL9cR3JIYHojf
45
45
  foxes/algorithms/sequential/models/plugin.py,sha256=HhCeHM_YoJRMXuZKa8rXUJZDhWf5rNl28_UfDLSGWvA,1330
46
46
  foxes/algorithms/sequential/models/seq_state.py,sha256=J1PorBVV5xZFWobHvCrGDCD-q7Egz_Op1p4PDiacBy0,3654
47
47
  foxes/config/__init__.py,sha256=k3irS7dNsXTzQpz9e6GOqoqGZkyMAW_BGxnV8JGcuRs,78
48
- foxes/config/config.py,sha256=L3p4p6hhWu-PsBXszBrmVM8YIDl79zVJTit2zpfnvjY,4118
48
+ foxes/config/config.py,sha256=e3HhitD2Xleqm3utoXLGAu8Vg16app35Cpx4nBhnZm8,4318
49
49
  foxes/core/__init__.py,sha256=3dOuKrFeSM6fCMxfLxTbzUsBPVTZiRp0sFhnibniBko,1021
50
50
  foxes/core/algorithm.py,sha256=ggdvtQT6kbmrgPUma-jCHqW7Q3ISvXHud1xl-t-kcls,27446
51
51
  foxes/core/axial_induction_model.py,sha256=sGbTHFMjEYKiVjElLP_SCRulKatcK0wsEXf30zty2Vc,1023
@@ -247,7 +247,7 @@ foxes/output/flow_plots_2d/get_fig.py,sha256=gGMOfzNCukq_l0FZLmi3zSBl0ANkQi2WoKa
247
247
  foxes/output/seq_plugins/__init__.py,sha256=d6Tl5NBVV4MaZwXtPgyxBXBnh7uCBFTbNzRU6IXCmQQ,110
248
248
  foxes/output/seq_plugins/seq_flow_ani_plugin.py,sha256=yAC-ZA_rkIOCHc1TN3uQYW0Z1CbxLTgP84Lrfr4D8cI,3654
249
249
  foxes/output/seq_plugins/seq_wake_debug_plugin.py,sha256=oAijRu9XRjUL9X4lZF-V6jqOfv8omokRp7YMkL1I2_M,3969
250
- foxes/utils/__init__.py,sha256=cVrVo5P9Ge-AxHAtc3_gMGmj1XL46xbfZY4okvIZNT8,744
250
+ foxes/utils/__init__.py,sha256=TkOej3vujD_5kM39hYlPTAuLtavrKZ16nO5wZloXPNA,777
251
251
  foxes/utils/cubic_roots.py,sha256=u2Pf-yHZ6EASpFONMfkv0mvldmd1E1VRZxj69YabDoc,3321
252
252
  foxes/utils/data_book.py,sha256=z96QUC9FI7mv1NEFJUkkTcxWqx5Fc9gPeyzPwbFbyoM,5301
253
253
  foxes/utils/dev_utils.py,sha256=6vryhcTg8lNXhtZOsQ0F8PTVpmUw250VNE-UyR0G70Y,1241
@@ -264,6 +264,7 @@ foxes/utils/subclasses.py,sha256=wCfhuialpBOQOPMwNbaplkVmf60vR9AIkY_o3tdkgXI,173
264
264
  foxes/utils/tab_files.py,sha256=H50IpLaqffJn9A51orCGc4fOhCOzoNUYDUKek4OAayU,1811
265
265
  foxes/utils/two_circles.py,sha256=xkj-SA_x-VXY7KtmSU4lcV4gFdplyhU3sBAC9vTdkF4,2810
266
266
  foxes/utils/wind_dir.py,sha256=6W0njWDvnIdOOjwqcMr64MW9ApjdtFA75blVUxirPMo,2823
267
+ foxes/utils/wrg_utils.py,sha256=3T6NkznU1_nc5bTaq-rEuBRFeBPjqP4XnEhwhQArKnk,2019
267
268
  foxes/utils/xarray_utils.py,sha256=6VLTAitXTK6W5zlBTadWwN05qmq_TlEDpUCx227JxtY,1677
268
269
  foxes/utils/abl/__init__.py,sha256=ijn-ubLLlqqH6tTAXFRmBAxJZmVBlTEmtx1cdCCtG4I,135
269
270
  foxes/utils/abl/neutral.py,sha256=E4DEhvXvw74BPrYr1MjQjeIaoz6ZOTWVlqScKflm-0M,1358
@@ -302,9 +303,9 @@ tests/1_verification/flappy_0_6_2/row_Bastankhah_Crespo/flappy/run.py,sha256=nwI
302
303
  tests/1_verification/flappy_0_6_2/row_Bastankhah_linear_centre/test_row_Bastankhah_linear_centre.py,sha256=a7CQS-_Mnz3NynaTv1OY1CZ10iAqa7E3YxmkbDtoshw,2590
303
304
  tests/1_verification/flappy_0_6_2/row_Bastankhah_linear_centre/flappy/run.py,sha256=s6FbEdpiIdHYmdD8S85_NhLH-S3EOinXvw8RHmR2QOU,2122
304
305
  tests/3_examples/test_examples.py,sha256=rS2Dz04ktbS6v3TRDr96AkWGypr5u49jihqbEmGFmRU,694
305
- foxes-1.2.3.dist-info/LICENSE,sha256=bBCH6mYTPzSepk2s2UUZ3II_ZYXrn1bnSqB85-aZHxU,1071
306
- foxes-1.2.3.dist-info/METADATA,sha256=3GhrNj9vLhSr7s_EZ75rAKRYoBZ9pu5_nH8UoIw6u4w,8811
307
- foxes-1.2.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
308
- foxes-1.2.3.dist-info/entry_points.txt,sha256=KuS44FRH5NnMw201A8Btr76eNRKr2UOoKHjejAsqKwE,123
309
- foxes-1.2.3.dist-info/top_level.txt,sha256=G7oHApEz5nc-iP__XsPcvjYe_NyXGmKMUMPHi3C3x6I,26
310
- foxes-1.2.3.dist-info/RECORD,,
306
+ foxes-1.2.4.dist-info/LICENSE,sha256=bBCH6mYTPzSepk2s2UUZ3II_ZYXrn1bnSqB85-aZHxU,1071
307
+ foxes-1.2.4.dist-info/METADATA,sha256=vAXcCQux4WPpc196ZFrNyXhyDNKBVL8PETlRB824oiM,8811
308
+ foxes-1.2.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
309
+ foxes-1.2.4.dist-info/entry_points.txt,sha256=KuS44FRH5NnMw201A8Btr76eNRKr2UOoKHjejAsqKwE,123
310
+ foxes-1.2.4.dist-info/top_level.txt,sha256=G7oHApEz5nc-iP__XsPcvjYe_NyXGmKMUMPHi3C3x6I,26
311
+ foxes-1.2.4.dist-info/RECORD,,
File without changes
File without changes