@@ -91,7 +91,7 @@ def get_meteonorm_forecast_basic(
91
91
Returns
92
92
-------
93
93
data : pd.DataFrame
94
- Time series data. The index corresponds to the start (left) of the
94
+ Time series data. The index corresponds to the middle of the
95
95
interval unless ``interval_index`` is set to True.
96
96
meta : dict
97
97
Metadata.
@@ -181,7 +181,7 @@ def get_meteonorm_forecast_precision(
181
181
Returns
182
182
-------
183
183
data : pd.DataFrame
184
- Time series data. The index corresponds to the start (left) of the
184
+ Time series data. The index corresponds to the middle of the
185
185
interval unless ``interval_index`` is set to True.
186
186
meta : dict
187
187
Metadata.
@@ -270,7 +270,7 @@ def get_meteonorm_observation_realtime(
270
270
Returns
271
271
-------
272
272
data : pd.DataFrame
273
- Time series data. The index corresponds to the start (left) of the
273
+ Time series data. The index corresponds to the middle of the
274
274
interval unless ``interval_index`` is set to True.
275
275
meta : dict
276
276
Metadata.
@@ -358,7 +358,7 @@ def get_meteonorm_observation_training(
358
358
Returns
359
359
-------
360
360
data : pd.DataFrame
361
- Time series data. The index corresponds to the start (left) of the
361
+ Time series data. The index corresponds to the middle of the
362
362
interval unless ``interval_index`` is set to True.
363
363
meta : dict
364
364
Metadata.
@@ -473,7 +473,7 @@ def get_meteonorm_tmy(
473
473
Returns
474
474
-------
475
475
data : pd.DataFrame
476
- Time series data. The index corresponds to the start (left) of the
476
+ Time series data. The index corresponds to the middle of the
477
477
interval unless ``interval_index`` is set to True.
478
478
meta : dict
479
479
Metadata.
@@ -513,12 +513,12 @@ def get_meteonorm_tmy(
513
513
start , end = None , None
514
514
515
515
data , meta = _get_meteonorm (
516
- latitude , longitude , start , end ,
517
- api_key , parameters ,
518
- surface_tilt , surface_azimuth ,
519
- time_step , horizon ,
520
- interval_index , map_variables ,
521
- url , endpoint , ** additional_params )
516
+ latitude , longitude , start , end ,
517
+ api_key , parameters ,
518
+ surface_tilt , surface_azimuth ,
519
+ time_step , horizon ,
520
+ interval_index , map_variables ,
521
+ url , endpoint , ** additional_params )
522
522
return data , meta
523
523
524
524
@@ -602,14 +602,14 @@ def _parse_meteonorm(response, interval_index, map_variables):
602
602
data = pd .DataFrame (data_json )
603
603
604
604
# xxx: experimental feature - see parameter description
605
- if interval_index :
606
- data . index = pd .IntervalIndex . from_arrays (
607
- left = pd .to_datetime (response .json ()["start_times " ]),
608
- right = pd . to_datetime ( response . json ()[ "end_times" ]) ,
609
- closed = "left" ,
610
- )
611
- else :
612
- data .index = pd . to_datetime ( response . json ()[ "start_times" ])
605
+ data . index = pd . IntervalIndex . from_arrays (
606
+ left = pd .to_datetime ( response . json ()[ "start_times" ]),
607
+ right = pd .to_datetime (response .json ()["end_times " ]),
608
+ closed = "left" ,
609
+ )
610
+
611
+ if not interval_index :
612
+ data .index = data . index . mid
613
613
614
614
meta = response .json ()["meta" ]
615
615
0 commit comments