Skip to content

Commit

Permalink
fix: Problem where data from the type TS_NMDH was parsed incorrectly …
Browse files Browse the repository at this point in the history
…producing a

nan at the beginning of each row.
  • Loading branch information
pesap committed Jan 15, 2025
1 parent b3eb179 commit c95abca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/r2x/defaults/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@
"fuel": "GAS",
"type": null
},
{
"fuel": "GAS",
"type": "CC"
},
{
"fuel": "GAS",
"type": "IG"
},
{
"fuel": "GAS",
"type": "IT"
},
{
"fuel": "OT",
"type": null
Expand Down
5 changes: 3 additions & 2 deletions src/r2x/parser/plexos.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ def _set_unit_capacity(self, record): # noqa: C901
return record

def _get_active_power_limits(self, record) -> MinMax:
assert record["base_power"] is not None
# assert record["base_power"] is not None
if active_power_min := record.get("min_rated_capacity"):
if isinstance(active_power_min, SingleTimeSeries):
active_power_min = np.nanmin(active_power_min.data)
Expand Down Expand Up @@ -1390,6 +1390,7 @@ def _data_file_handler(
parsed_file = parsed_file.unique(subset=columns_to_check).sort(pl.all())

# We reconcile the time series data using the hourly time stamp given by the solve year

parsed_file = reconcile_timeseries(parsed_file, hourly_time_index=self.hourly_time_index)
assert (
"value" in parsed_file.columns
Expand All @@ -1403,7 +1404,7 @@ def _create_columns_to_check(self, column_type: DATAFILE_COLUMNS):
for column in column_type.value
if column in ["name", "pattern", "year", "datetime", "month", "day", "period", "hour"]
]
if column_type == DATAFILE_COLUMNS.TS_YMDH:
if column_type == DATAFILE_COLUMNS.TS_YMDH or column_type == DATAFILE_COLUMNS.TS_NMDH:
columns_to_check.append("hour")
if column_type == DATAFILE_COLUMNS.TS_NM:
columns_to_check.append("month")
Expand Down

0 comments on commit c95abca

Please sign in to comment.