Skip to content

Commit 944c99f

Browse files
committed
Merge branch 'hotfixes-0.7.1' into staging
2 parents 2325f07 + b426c09 commit 944c99f

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

viresclient/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
from ._api.upload import DataUpload
3636
from ._api.token import TokenManager
3737

38-
__version__ = "0.7.0"
38+
__version__ = "0.7.1-alpha.1"

viresclient/_client_swarm.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,8 @@ def available_auxiliaries(self):
756756
return self._available["auxiliaries"]
757757

758758
def available_observatories(
759-
self, collection=None, start_time=None, end_time=None, details=False
759+
self, collection, start_time=None, end_time=None,
760+
details=False
760761
):
761762
"""Get list of available observatories from server.
762763
@@ -780,8 +781,9 @@ def available_observatories(
780781
)
781782
782783
Args:
783-
collection (str): collection name (e.g. `"SW_OPER_AUX_OBSM2_"`)
784-
custom_model (str): as with set_products
784+
collection (str): OBS collection name, e.g. "SW_OPER_AUX_OBSM2_"
785+
start_time (datetime / ISO_8601 string)
786+
end_time (datetime / ISO_8601 string)
785787
details (bool): returns DataFrame if True
786788
787789
Returns:
@@ -822,6 +824,7 @@ def _csv_to_df(csv_data):
822824
else:
823825
start_time, end_time = None, None
824826

827+
self._detect_AUX_OBS([collection])
825828
response = _request_get_observatories(collection, start_time, end_time)
826829
df = _csv_to_df(response)
827830
if details:
@@ -838,20 +841,20 @@ def _detect_AUX_OBS(self, collections):
838841
# Output notification for each of aux_type
839842
for aux_type in ["AUX_OBSH", "AUX_OBSM", "AUX_OBSS"]:
840843
if aux_type in collection_types_requested:
841-
tqdm.write(
842-
dedent(
843-
f"""
844+
output_text = dedent(f"""
844845
Accessing INTERMAGNET and/or WDC data
845846
Check usage terms at {DATA_CITATIONS.get(aux_type)}
846-
"""
847-
)
848-
)
847+
""")
848+
if aux_type == "AUX_OBSH":
849+
output_text += "WARNING: AUX_OBSH is not yet public"
850+
tqdm.write(output_text)
849851

850-
def set_collection(self, *args):
852+
def set_collection(self, *args, verbose=True):
851853
"""Set the collection(s) to use.
852854
853855
Args:
854856
(str): one or several from .available_collections()
857+
verbose (bool): Notify if special data terms
855858
856859
"""
857860
collections = [*args]
@@ -867,7 +870,8 @@ def set_collection(self, *args):
867870
"Check available with SwarmRequest().available_collections()"
868871
.format(collection)
869872
)
870-
self._detect_AUX_OBS(collections)
873+
if verbose:
874+
self._detect_AUX_OBS(collections)
871875
self._collection_list = collections
872876
self._request_inputs.set_collections(collections)
873877
return self

viresclient/_data_handling.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,16 @@ def as_pandas_dataframe(self, expand=False):
160160
columns = set(self.variables)
161161
columns.remove("Timestamp")
162162
# Split columns according to those to be expanded into multiple columns
163-
columns_to_expand = set(c for c in columns
164-
if c in DATANAMES_TO_FRAME_NAMES.keys()
165-
or "B_NEC" in c) if expand else set()
163+
if expand:
164+
columns_to_expand = set(c for c in columns
165+
if c in DATANAMES_TO_FRAME_NAMES.keys()
166+
or "B_NEC" in c)
167+
# Avoid conflict with 2D AOB_FAC Quality variable
168+
# when accessing AUX_OBS Quality
169+
if any(["AUX_OBS" in s for s in self.sources]):
170+
columns_to_expand.discard("Quality")
171+
else:
172+
columns_to_expand = set()
166173
columns_standard = columns.difference(columns_to_expand)
167174
# Initialise dataframe with Timestamp as index
168175
df = pandas.DataFrame(index=self.get_variable("Timestamp"))

0 commit comments

Comments
 (0)