psi-data-utils 0.0.2__tar.gz → 1.0.0__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.4
2
2
  Name: psi-data-utils
3
- Version: 0.0.2
3
+ Version: 1.0.0
4
4
  Summary: Sample data fetching and management utilities for Predictive Science Inc.
5
5
  Author: Ryder Davidson
6
6
  Author-email: "Predictive Science Inc." <webmaster@predsci.com>
@@ -209,14 +209,14 @@ def fetch_mas_data(*, domains: Optional[Iterable] = 'cor',
209
209
  PosixPath('.../cor/mhd/br002.h5')
210
210
  """
211
211
  if domains is None:
212
- domains = {"cor", "hel"}
212
+ domains = ("cor", "hel")
213
213
  else:
214
- domains = set(domains.replace(" ", "").lower().split(",") if isinstance(domains, str) else domains)
214
+ domains = tuple(domains.replace(" ", "").lower().split(",") if isinstance(domains, str) else domains)
215
215
 
216
216
  if variables is None:
217
217
  variables = set.intersection(*(DOM_VAR_MAP[dom] for dom in domains))
218
218
  else:
219
- variables = set(variables.replace(" ", "").lower().split(",") if isinstance(variables, str) else variables)
219
+ variables = tuple(variables.replace(" ", "").lower().split(",") if isinstance(variables, str) else variables)
220
220
  req_pairs = product(domains, variables)
221
221
 
222
222
  ext = HDF_EXT.get(hdf)
@@ -275,7 +275,7 @@ def fetch_mas_quantities(*, quantities: Optional[Iterable] = 'ch_pm', hdf: int =
275
275
  if quantities is None:
276
276
  quantities = DOM_VAR_MAP["quantities"]
277
277
  else:
278
- quantities = set(quantities.replace(" ", "").lower().split(",") if isinstance(quantities, str) else quantities)
278
+ quantities = tuple(quantities.replace(" ", "").lower().split(",") if isinstance(quantities, str) else quantities)
279
279
 
280
280
  ext = HDF_EXT.get(hdf)
281
281
  filepaths = {
@@ -333,7 +333,7 @@ def fetch_pot3d_data(*, variables: Optional[Iterable] = 'br', hdf: int = 5) -> o
333
333
  if variables is None:
334
334
  variables = DOM_VAR_MAP["pot3d"]
335
335
  else:
336
- variables = set(variables.replace(" ", "").lower().split(",") if isinstance(variables, str) else variables)
336
+ variables = tuple(variables.replace(" ", "").lower().split(",") if isinstance(variables, str) else variables)
337
337
 
338
338
  ext = HDF_EXT.get(hdf)
339
339
  filepaths = {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: psi-data-utils
3
- Version: 0.0.2
3
+ Version: 1.0.0
4
4
  Summary: Sample data fetching and management utilities for Predictive Science Inc.
5
5
  Author: Ryder Davidson
6
6
  Author-email: "Predictive Science Inc." <webmaster@predsci.com>
@@ -11,7 +11,7 @@ requires = ["setuptools >= 74.0.0"]
11
11
  # ----------------
12
12
  [project]
13
13
  name = "psi-data-utils"
14
- version = "0.0.2"
14
+ version = "1.0.0"
15
15
  description = "Sample data fetching and management utilities for Predictive Science Inc."
16
16
  authors = [
17
17
  {name = "Predictive Science Inc.", email = "webmaster@predsci.com"},
@@ -106,6 +106,23 @@ def test_fetch_mas_data_keys_exist_in_registry(fake_fetch):
106
106
  assert key in sa.FETCHER.registry, f"{key} not in registry"
107
107
 
108
108
 
109
+ def test_fetch_mas_returns_ordered_namedtuple(fake_fetch):
110
+ paths = sa.fetch_mas_data(domains="cor", variables="br,bt,bp", hdf=5)
111
+ assert paths._fields == ("cor_br", "cor_bt", "cor_bp")
112
+ assert paths[0] == Path("H5CR2309_hmi_mast_mas_std_0201/cor/mhd/br002.h5")
113
+ assert paths[1] == Path("H5CR2309_hmi_mast_mas_std_0201/cor/mhd/bt002.h5")
114
+ assert paths[2] == Path("H5CR2309_hmi_mast_mas_std_0201/cor/mhd/bp002.h5")
115
+
116
+
117
+ def test_fetch_mas_returns_ordered_namedtuple_with_multiple_domains(fake_fetch):
118
+ paths = sa.fetch_mas_data(domains="cor,hel", variables="br,bt", hdf=5)
119
+ assert paths._fields == ("cor_br", "cor_bt", "hel_br", "hel_bt")
120
+ assert paths[0] == Path("H5CR2309_hmi_mast_mas_std_0201/cor/mhd/br002.h5")
121
+ assert paths[1] == Path("H5CR2309_hmi_mast_mas_std_0201/cor/mhd/bt002.h5")
122
+ assert paths[2] == Path("H5CR2309_hmi_mast_mas_std_0201/hel/mhd/br002.h5")
123
+ assert paths[3] == Path("H5CR2309_hmi_mast_mas_std_0201/hel/mhd/bt002.h5")
124
+
125
+
109
126
  # --- fetch_pot3d_data --------------------------------------------------------
110
127
 
111
128
  def test_fetch_pot3d_data_default(fake_fetch):
@@ -119,6 +136,14 @@ def test_fetch_pot3d_data_none_fetches_all_components(fake_fetch):
119
136
  assert set(paths._fields) == {"br", "bt", "bp"}
120
137
 
121
138
 
139
+ def test_fetch_pot3d_returns_ordered_namedtuple(fake_fetch):
140
+ paths = sa.fetch_pot3d_data(variables="br,bt,bp", hdf=5)
141
+ assert paths._fields == ("br", "bt", "bp")
142
+ assert paths[0] == Path("H5CR2309_hmi_mast_mas_std_0201/cor/pfss/br.h5")
143
+ assert paths[1] == Path("H5CR2309_hmi_mast_mas_std_0201/cor/pfss/bt.h5")
144
+ assert paths[2] == Path("H5CR2309_hmi_mast_mas_std_0201/cor/pfss/bp.h5")
145
+
146
+
122
147
  # --- fetch_mas_quantities ----------------------------------------------------
123
148
 
124
149
  def test_fetch_mas_quantities_default(fake_fetch):
File without changes
File without changes