hydroserverpy 1.4.0b4__py3-none-any.whl → 1.5.0__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 hydroserverpy might be problematic. Click here for more details.

@@ -74,7 +74,7 @@ class Timestamp(BaseModel):
74
74
  timezone: Optional[Union[FixedOffsetTimezone, str]] = Field(None, alias="timezone")
75
75
 
76
76
  class Config:
77
- allow_population_by_field_name = True
77
+ populate_by_name = True
78
78
 
79
79
  @field_validator("timezone")
80
80
  def check_timezone(cls, timezone_value, info):
@@ -96,7 +96,7 @@ class RunTimePlaceholder(BaseModel):
96
96
  timestamp: Timestamp
97
97
 
98
98
  class Config:
99
- allow_population_by_field_name = True
99
+ populate_by_name = True
100
100
 
101
101
 
102
102
  PlaceholderVariable = Annotated[
@@ -114,7 +114,7 @@ class BaseExtractor(BaseModel):
114
114
  )
115
115
 
116
116
  class Config:
117
- allow_population_by_field_name = True
117
+ populate_by_name = True
118
118
 
119
119
 
120
120
  class HTTPExtractor(BaseExtractor):
@@ -140,7 +140,7 @@ class JSONTransformer(BaseTransformer):
140
140
  jmespath: str = Field(..., alias="JMESPath")
141
141
 
142
142
  class Config:
143
- allow_population_by_field_name = True
143
+ populate_by_name = True
144
144
 
145
145
 
146
146
  class CSVTransformer(BaseTransformer):
@@ -151,7 +151,7 @@ class CSVTransformer(BaseTransformer):
151
151
  identifier_type: IdentifierType = Field(..., alias="identifierType")
152
152
 
153
153
  class Config:
154
- allow_population_by_field_name = True
154
+ populate_by_name = True
155
155
 
156
156
 
157
157
  TransformerConfig = Union[JSONTransformer, CSVTransformer]
@@ -173,7 +173,7 @@ class ExpressionDataTransformation(BaseModel):
173
173
  expression: str
174
174
 
175
175
  class Config:
176
- allow_population_by_field_name = True
176
+ populate_by_name = True
177
177
 
178
178
 
179
179
  class LookupTableDataTransformation(BaseModel):
@@ -181,7 +181,7 @@ class LookupTableDataTransformation(BaseModel):
181
181
  lookup_table_id: str = Field(..., alias="lookupTableId")
182
182
 
183
183
  class Config:
184
- allow_population_by_field_name = True
184
+ populate_by_name = True
185
185
 
186
186
 
187
187
  DataTransformation = Union[ExpressionDataTransformation, LookupTableDataTransformation]
@@ -194,7 +194,7 @@ class MappingPath(BaseModel):
194
194
  )
195
195
 
196
196
  class Config:
197
- allow_population_by_field_name = True
197
+ populate_by_name = True
198
198
 
199
199
 
200
200
  class SourceTargetMapping(BaseModel):
@@ -202,7 +202,7 @@ class SourceTargetMapping(BaseModel):
202
202
  paths: List[MappingPath] = Field(default_factory=list)
203
203
 
204
204
  class Config:
205
- allow_population_by_field_name = True
205
+ populate_by_name = True
206
206
 
207
207
 
208
208
  class Payload(BaseModel):
@@ -213,7 +213,7 @@ class Payload(BaseModel):
213
213
  )
214
214
 
215
215
  class Config:
216
- allow_population_by_field_name = True
216
+ populate_by_name = True
217
217
 
218
218
 
219
219
  class EtlConfiguration(BaseModel):
@@ -13,4 +13,4 @@ class Schedule(BaseModel):
13
13
  end_time: Optional[datetime] = Field(None, alias="endTime")
14
14
 
15
15
  class Config:
16
- allow_population_by_field_name = True
16
+ populate_by_name = True
@@ -11,4 +11,4 @@ class Status(BaseModel):
11
11
  next_run: Optional[datetime] = Field(None, alias="nextRun")
12
12
 
13
13
  class Config:
14
- allow_population_by_field_name = True
14
+ populate_by_name = True
@@ -194,6 +194,7 @@ class Datastream(HydroServerBaseModel):
194
194
  order_by: List[str] = ...,
195
195
  phenomenon_time_max: datetime = ...,
196
196
  phenomenon_time_min: datetime = ...,
197
+ result_qualifier_code: str = ...,
197
198
  fetch_all: bool = False,
198
199
  ) -> pd.DataFrame:
199
200
  """Retrieve the observations for this datastream."""
@@ -205,18 +206,21 @@ class Datastream(HydroServerBaseModel):
205
206
  order_by=order_by,
206
207
  phenomenon_time_max=phenomenon_time_max,
207
208
  phenomenon_time_min=phenomenon_time_min,
209
+ result_qualifier_code=result_qualifier_code,
208
210
  fetch_all=fetch_all
209
211
  )
210
212
 
211
213
  def load_observations(
212
214
  self,
213
215
  observations: pd.DataFrame,
216
+ mode: str = "insert"
214
217
  ) -> None:
215
218
  """Load a DataFrame of observations to the datastream."""
216
219
 
217
220
  return self.client.datastreams.load_observations(
218
221
  uid=self.uid,
219
222
  observations=observations,
223
+ mode=mode
220
224
  )
221
225
 
222
226
  def delete_observations(
@@ -38,7 +38,9 @@ class ObservationCollection:
38
38
  data = response.json()
39
39
  self.dataframe = pd.DataFrame({to_snake(k): v for k, v in data.items()})
40
40
  if "phenomenon_time" in self.dataframe.columns:
41
- self.dataframe["phenomenon_time"] = pd.to_datetime(self.dataframe["phenomenon_time"], utc=True)
41
+ self.dataframe["phenomenon_time"] = pd.to_datetime(
42
+ self.dataframe["phenomenon_time"], utc=True, format="ISO8601"
43
+ )
42
44
  else:
43
45
  self.dataframe = pd.DataFrame()
44
46
 
@@ -220,6 +220,7 @@ class DatastreamService(HydroServerBaseService):
220
220
  order_by: List[str] = ...,
221
221
  phenomenon_time_max: datetime = ...,
222
222
  phenomenon_time_min: datetime = ...,
223
+ result_qualifier_code: str = ...,
223
224
  fetch_all: bool = False,
224
225
  ) -> ObservationCollection:
225
226
  """Retrieve observations of a datastream."""
@@ -230,6 +231,7 @@ class DatastreamService(HydroServerBaseService):
230
231
  "order_by": ",".join(order_by) if order_by is not ... else order_by,
231
232
  "phenomenon_time_max": phenomenon_time_max,
232
233
  "phenomenon_time_min": phenomenon_time_min,
234
+ "result_qualifier_code": result_qualifier_code,
233
235
  "format": "column"
234
236
  }
235
237
  params = {
@@ -256,12 +258,13 @@ class DatastreamService(HydroServerBaseService):
256
258
  self,
257
259
  uid: Union[UUID, str],
258
260
  observations: pd.DataFrame,
261
+ mode: str = "insert"
259
262
  ) -> None:
260
263
  """Load observations to a datastream."""
261
264
 
262
265
  path = f"/{self.client.base_route}/{self.model.get_route()}/{str(uid)}/observations/bulk-create"
263
266
  headers = {"Content-type": "application/json"}
264
- params = {"mode": "insert"}
267
+ params = {"mode": mode}
265
268
  body = {
266
269
  "fields": [to_camel(col) for col in observations.columns.tolist()],
267
270
  "data": observations.values.tolist()
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.4
2
+ Name: hydroserverpy
3
+ Version: 1.5.0
4
+ Summary: A Python client for managing HydroServer data
5
+ Requires-Python: <4,>=3.9
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: requests>=2
9
+ Requires-Dist: pydantic>=2.6
10
+ Requires-Dist: pydantic[email]>=2.6
11
+ Requires-Dist: pandas>=2.1
12
+ Requires-Dist: numpy>=1.22.4
13
+ Requires-Dist: pyyaml>=5
14
+ Requires-Dist: simplejson>=3
15
+ Requires-Dist: crontab>=1
16
+ Requires-Dist: python-dateutil>=2.8.2
17
+ Requires-Dist: croniter>=2.0.1
18
+ Requires-Dist: jmespath>=1.0.1
19
+ Provides-Extra: docs
20
+ Requires-Dist: sphinx_autodoc_typehints; extra == "docs"
21
+ Dynamic: license-file
22
+
23
+ # HydroServer Python Client
24
+
25
+ The hydroserverpy Python package provides an interface for managing HydroServer data and metadata, loading observations, and performing data quality control. This guide will go over how to install the package and connect to a HydroServer instance. Full hydroserverpy documentation and examples can be found [here](https://hydroserver2.github.io/hydroserver/how-to/hydroserverpy/hydroserverpy-examples.html).
26
+
27
+ ## Installation
28
+
29
+ You can install the package via pip:
30
+
31
+ ```bash
32
+ pip install hydroserverpy
33
+ ```
34
+
35
+ ## Connecting to HydroServer
36
+
37
+ To connect to HydroServer, you need to initialize the client with the instance of HydroServer you're using and your user credentials if you want to access and modify your own data. If you don't provide authentication credentials you can read public data, but you will not be able to create or modify any data.
38
+
39
+ ### Example: Anonymous User
40
+
41
+ ```python
42
+ from hydroserverpy import HydroServer
43
+
44
+ # Initialize HydroServer connection.
45
+ hs_api = HydroServer(
46
+ host='https://playground.hydroserver.org'
47
+ )
48
+ ```
49
+
50
+ ### Example: Basic Authentication
51
+
52
+ ```python
53
+ from hydroserverpy import HydroServer
54
+
55
+ # Initialize HydroServer connection with credentials.
56
+ hs_api = HydroServer(
57
+ host='https://playground.hydroserver.org',
58
+ email='user@example.com',
59
+ password='******'
60
+ )
61
+ ```
62
+
63
+ ## Funding and Acknowledgements
64
+
65
+ Funding for this project was provided by the National Oceanic & Atmospheric Administration (NOAA), awarded to the Cooperative Institute for Research to Operations in Hydrology (CIROH) through the NOAA Cooperative Agreement with The University of Alabama (NA22NWS4320003). Utah State University is a founding member of CIROH and receives funding under subaward from the University of Alabama. Additional funding and support have been provided by the State of Utah Division of Water Rights, the World Meteorological Organization, and the Utah Water Research laboratory at Utah State University.
66
+
@@ -7,12 +7,12 @@ hydroserverpy/api/models/base.py,sha256=mQZbanDg9t2GN9mOR_XOOtAfYF7AkY0fBZ6fHat6
7
7
  hydroserverpy/api/models/etl/__init__.py,sha256=_D8_Nbs06-47wwsHOAF9tOohQYQ52gOhz_NUyfloMUw,699
8
8
  hydroserverpy/api/models/etl/data_archive.py,sha256=rnmD_FQ1yjJ0KPBigylAQ3uQ6QBppJtBopJK4oCPLSo,2613
9
9
  hydroserverpy/api/models/etl/data_source.py,sha256=YWSdudFONe1eniGBkruLRAP8BDyt0tGmZD8hzzByjKU,5123
10
- hydroserverpy/api/models/etl/etl_configuration.py,sha256=anD_0zlldJKogie15j9SIabJvNqnY5fz5xjuFsFUFwU,6034
10
+ hydroserverpy/api/models/etl/etl_configuration.py,sha256=_HuU6Uwtn7PSsMWSbO46lei2AtopmSKHcYtPRUmlF0g,5894
11
11
  hydroserverpy/api/models/etl/factories.py,sha256=-inTw_C694YieDU4vbrm1qyeZMEYZqVhHSyEQJLMueo,802
12
12
  hydroserverpy/api/models/etl/orchestration_configuration.py,sha256=ElSrgi7ioFZJFJg6aGogW5ZZk7fA17y4p--yWwiOhZ0,1367
13
13
  hydroserverpy/api/models/etl/orchestration_system.py,sha256=5wdGsXCMqHfE3--zG-3WAPAVPNMPIx99y-7UUhdCink,2060
14
- hydroserverpy/api/models/etl/schedule.py,sha256=-TxRpYSFbyYkzAPBWOh5udx1s6v1SvLl3_LE2j_b1uE,512
15
- hydroserverpy/api/models/etl/status.py,sha256=vYT7go7DMcOgy29w0yhHpKz6AdprLmOxWZE9G_DHVdw,503
14
+ hydroserverpy/api/models/etl/schedule.py,sha256=WF4C9aQhEDh0ldMXhuCWvTYYMnc2roqz9lEYUPn1xEs,498
15
+ hydroserverpy/api/models/etl/status.py,sha256=BWM1cNx_bKza9dGn769s2tThtyFtzb2JX8_dlmO11Fg,489
16
16
  hydroserverpy/api/models/etl/timestamp_parser.py,sha256=lDnParK2j2M9TF7qspJDeKFGGpO4d1F2KJEKZ4xH5Yw,4374
17
17
  hydroserverpy/api/models/etl/types.py,sha256=4PY3CM-uoXIsf2lhcqtLC6HaRGXe7HKGDU22R8-H35c,135
18
18
  hydroserverpy/api/models/etl/extractors/__init__.py,sha256=Z0viw2vk96Ytpz3n7ODtkYz9Zx0I0NsZUbna2ZWvhkw,243
@@ -34,8 +34,8 @@ hydroserverpy/api/models/iam/collaborator.py,sha256=w1D72PsiwmdgFVNlkNV3TPjMR6lx
34
34
  hydroserverpy/api/models/iam/role.py,sha256=zYTzMwnnpelZHP0uPg3vZqWqcpSROqrJ58bVkpFeTEQ,1092
35
35
  hydroserverpy/api/models/iam/workspace.py,sha256=hB4W8b_cC9WhBmwGHX_VfDjqriniQgvc2BKz_j9Gh0U,8884
36
36
  hydroserverpy/api/models/sta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
- hydroserverpy/api/models/sta/datastream.py,sha256=1JILQUZAipxGLHY8zVPRQzXZTq5ktTVWK7dPcvTjjZY,8736
38
- hydroserverpy/api/models/sta/observation.py,sha256=oIqm4I98rnN7cAVL6tcWBXluC6qIfO1h4WhwP7R9LXs,3641
37
+ hydroserverpy/api/models/sta/datastream.py,sha256=YS6BTc_MBEecbtOnyrQPb9YyYdt1orP43Ku9jONi5A0,8886
38
+ hydroserverpy/api/models/sta/observation.py,sha256=DcLMqObILhj0w0xgTak512KF_UV7DK8YCJv9j3Sd9wo,3697
39
39
  hydroserverpy/api/models/sta/observed_property.py,sha256=KpeU8mn0U-e6iBQh34YewSBEC4fY88sJr30B8O6kiXQ,1204
40
40
  hydroserverpy/api/models/sta/processing_level.py,sha256=OQKc3pxi6ST36O7qEmLPA6ALXpuUXW2ADhR7XX-CaBk,1080
41
41
  hydroserverpy/api/models/sta/result_qualifier.py,sha256=kenPF1B11Q5aa3c7mnHcmMmSQMziWNyiYxGK1Il4Df8,1012
@@ -52,7 +52,7 @@ hydroserverpy/api/services/iam/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
52
52
  hydroserverpy/api/services/iam/role.py,sha256=PV0odC_lL9kV3ggrTjAUEMTo0WNUzv4AeMHNAXlkbN8,1137
53
53
  hydroserverpy/api/services/iam/workspace.py,sha256=V4ter_XJQocdXB-11IRdL5jzVmXdtOHlbAuqw42bEks,7995
54
54
  hydroserverpy/api/services/sta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
- hydroserverpy/api/services/sta/datastream.py,sha256=Cnse8etWeWmRF3g5NG4Wmok0_11ZVq46p269QX2yhJ4,11450
55
+ hydroserverpy/api/services/sta/datastream.py,sha256=fiLXDB4u2yyGOK16gNm0O4cWm9hJ0wgPf8elRk6arX4,11577
56
56
  hydroserverpy/api/services/sta/observed_property.py,sha256=hKoTXRhoJSveR7S9KuokUowadhS3b1VFE-VqCnMRbvU,2516
57
57
  hydroserverpy/api/services/sta/processing_level.py,sha256=d5ReGxX193NsYW18k1RWPPIBoEsDPc6LVerDAD_UBvs,2175
58
58
  hydroserverpy/api/services/sta/result_qualifier.py,sha256=gkgofUqzGXgdkyAvK9RW_dyTn1MPxpd99jdcn7zpWHM,1783
@@ -61,9 +61,9 @@ hydroserverpy/api/services/sta/thing.py,sha256=Hyo3zTghSs7IIdsOGRu35i9w-aGOYlK9b
61
61
  hydroserverpy/api/services/sta/unit.py,sha256=NFToSAIGTwDfwYWe8Q-I_f5xsw_GYzFEkMnhSJ-ChvE,2178
62
62
  hydroserverpy/quality/__init__.py,sha256=GGBMkFSXciJLYrbV-NraFrj_mXWCy_GTcy9KKrKXU4c,84
63
63
  hydroserverpy/quality/service.py,sha256=U02UfLKVmFvr5ySiH0n0JYzUIabq5uprrHIiwcqBlqY,13879
64
- hydroserverpy-1.4.0b4.dist-info/licenses/LICENSE,sha256=xVqFxDw3QOEJukakL7gQCqIMTQ1dlSCTo6Oc1otNW80,1508
65
- hydroserverpy-1.4.0b4.dist-info/METADATA,sha256=GCgulq3Im1uhFlRJtRg54dwOIqHK3wFfxAXpT6hlDlA,532
66
- hydroserverpy-1.4.0b4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
67
- hydroserverpy-1.4.0b4.dist-info/top_level.txt,sha256=Zf37hrncXLOYvXhgCrf5mZdeq81G9fShdE2LfYbtb7w,14
68
- hydroserverpy-1.4.0b4.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
69
- hydroserverpy-1.4.0b4.dist-info/RECORD,,
64
+ hydroserverpy-1.5.0.dist-info/licenses/LICENSE,sha256=xVqFxDw3QOEJukakL7gQCqIMTQ1dlSCTo6Oc1otNW80,1508
65
+ hydroserverpy-1.5.0.dist-info/METADATA,sha256=OFlPuMhx-h0RzgmtdoKuEsq6scGeUTsfyDbeM_xhdlg,2585
66
+ hydroserverpy-1.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
67
+ hydroserverpy-1.5.0.dist-info/top_level.txt,sha256=Zf37hrncXLOYvXhgCrf5mZdeq81G9fShdE2LfYbtb7w,14
68
+ hydroserverpy-1.5.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
69
+ hydroserverpy-1.5.0.dist-info/RECORD,,
@@ -1,19 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: hydroserverpy
3
- Version: 1.4.0b4
4
- Requires-Python: <4,>=3.9
5
- License-File: LICENSE
6
- Requires-Dist: requests>=2
7
- Requires-Dist: pydantic>=2.6
8
- Requires-Dist: pydantic[email]>=2.6
9
- Requires-Dist: pandas>=2.2
10
- Requires-Dist: numpy>=2.0
11
- Requires-Dist: pyyaml>=5
12
- Requires-Dist: simplejson>=3
13
- Requires-Dist: crontab>=1
14
- Requires-Dist: python-dateutil>=2.8.2
15
- Requires-Dist: croniter>=2.0.1
16
- Requires-Dist: jmespath>=1.0.1
17
- Provides-Extra: docs
18
- Requires-Dist: sphinx_autodoc_typehints; extra == "docs"
19
- Dynamic: license-file