1111
1212def get_timeseries_group (
1313 group_id : str ,
14- category_id : str ,
15- category_office_id : str ,
14+ category_id : Optional [ str ] = None ,
15+ category_office_id : Optional [ str ] = None ,
1616 office_id : Optional [str ] = None ,
1717 group_office_id : Optional [str ] = None ,
1818) -> Data :
@@ -54,14 +54,16 @@ def get_timeseries_groups(
5454 timeseries_category_like : Optional [str ] = None ,
5555 timeseries_group_like : Optional [str ] = None ,
5656 category_office_id : Optional [str ] = None ,
57+ group_office_id : Optional [str ] = None ,
5758) -> Data :
5859 """
5960 Retreives a list of time series groups.
6061
6162 Parameters
6263 ----------
63- category_id: string
64- The category id that contains the timeseries group.
64+ office_id: string
65+ Specifies the owning office of the timeseries assigned to the group(s).
66+ If not specified, group information for all assigned TS offices is returned.
6567 include_assigned: Boolean
6668 Include the assigned timeseries in the returned timeseries groups. (default: true)
6769 timeseries_category_like: string
@@ -70,6 +72,8 @@ def get_timeseries_groups(
7072 Posix regular expression matching against the timeseries group id
7173 category_office_id: string
7274 Specifies the owning office of the timeseries group category
75+ group_office_id: string
76+ Specifies the owning office of the timeseries group
7377 Returns
7478 -------
7579 cwms data type. data.json will return the JSON output and data.df will return a dataframe
@@ -78,9 +82,10 @@ def get_timeseries_groups(
7882 endpoint = "timeseries/group"
7983 params = {
8084 "office" : office_id ,
85+ "group-office-id" : group_office_id ,
8186 "include-assigned" : include_assigned ,
8287 "timeseries-category-like" : timeseries_category_like ,
83- "timeseries_group_like " : timeseries_group_like ,
88+ "timeseries-group-like " : timeseries_group_like ,
8489 "category-office-id" : category_office_id ,
8590 }
8691 response = api .get (endpoint = endpoint , params = params , api_version = 1 )
@@ -165,7 +170,11 @@ def timeseries_group_df_to_json(
165170 return json_dict
166171
167172
168- def store_timeseries_groups (data : JSON , fail_if_exists : Optional [bool ] = True ) -> None :
173+ def store_timeseries_groups (
174+ data : JSON ,
175+ fail_if_exists : Optional [bool ] = True ,
176+ ignore_nulls : Optional [bool ] = True ,
177+ ) -> None :
169178 """
170179 Create new TimeSeriesGroup
171180 Parameters
@@ -174,6 +183,11 @@ def store_timeseries_groups(data: JSON, fail_if_exists: Optional[bool] = True) -
174183 Time Series data to be stored.
175184 fail_if_exists: Boolean Defualt = True
176185 Create will fail if provided ID already exists.
186+ ignore_nulls: Boolean Default = True
187+ Ignore null values in the request body. If fail_if_exists is False
188+ and ignore_nulls is False, an existing group's description or
189+ assigned time series list may be replaced with null/empty values
190+ from the request body.
177191
178192 Returns
179193 -------
@@ -184,7 +198,7 @@ def store_timeseries_groups(data: JSON, fail_if_exists: Optional[bool] = True) -
184198 raise ValueError ("Cannot store a standard text without timeseries group JSON" )
185199
186200 endpoint = "timeseries/group"
187- params = {"fail-if-exists" : fail_if_exists }
201+ params = {"fail-if-exists" : fail_if_exists , "ignore-nulls" : ignore_nulls }
188202
189203 return api .post (endpoint , data , params , api_version = 1 )
190204
@@ -227,7 +241,12 @@ def update_timeseries_groups(
227241 api .patch (endpoint = endpoint , data = data , params = params , api_version = 1 )
228242
229243
230- def delete_timeseries_group (group_id : str , category_id : str , office_id : str ) -> None :
244+ def delete_timeseries_group (
245+ group_id : str ,
246+ category_id : str ,
247+ office_id : str ,
248+ cascade_delete : Optional [bool ] = False ,
249+ ) -> None :
231250 """Deletes requested time series group
232251
233252 Parameters
@@ -238,6 +257,8 @@ def delete_timeseries_group(group_id: str, category_id: str, office_id: str) ->
238257 Specifies the time series category of the time series group to be deleted
239258 office_id: string
240259 Specifies the owning office of the time series group to be deleted
260+ cascade_delete: Boolean Default = False
261+ Specifies whether to unassign time series in this group before deleting.
241262
242263 Returns
243264 -------
@@ -248,6 +269,7 @@ def delete_timeseries_group(group_id: str, category_id: str, office_id: str) ->
248269 params = {
249270 "office" : office_id ,
250271 "category-id" : category_id ,
272+ "cascade-delete" : cascade_delete ,
251273 }
252274
253275 return api .delete (endpoint , params = params , api_version = 1 )
0 commit comments