Skip to content

Commit

Permalink
Rename meta columns when reading data
Browse files Browse the repository at this point in the history
  • Loading branch information
ppinchuk committed May 29, 2024
1 parent d3142b7 commit ce68fec
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/test_hybrids.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from reV.cli import main
from reV.hybrids import HYBRID_METHODS, Hybridization
from reV.hybrids.hybrids import MERGE_COLUMN, OUTPUT_PROFILE_NAMES, HybridsData
from reV.utilities import ModuleName, SupplyCurveField
from reV.utilities import ModuleName, SupplyCurveField, OldSupplyCurveField
from reV.utilities.exceptions import FileInputError, InputError, OutputWarning

SOLAR_FPATH = os.path.join(
Expand All @@ -29,9 +29,15 @@
TESTDATADIR, "rep_profiles_out", "rep_profiles_solar_multiple.h5"
)
with Resource(SOLAR_FPATH) as res:
SOLAR_SCPGIDS = set(res.meta[SupplyCurveField.SC_POINT_GID])
meta = res.meta.rename(
columns=SupplyCurveField.map_from(OldSupplyCurveField)
)
SOLAR_SCPGIDS = set(meta[SupplyCurveField.SC_POINT_GID])
with Resource(WIND_FPATH) as res:
WIND_SCPGIDS = set(res.meta[SupplyCurveField.SC_POINT_GID])
meta = res.meta.rename(
columns=SupplyCurveField.map_from(OldSupplyCurveField)
)
WIND_SCPGIDS = set(meta[SupplyCurveField.SC_POINT_GID])


def test_hybridization_profile_output_single_resource():
Expand All @@ -57,7 +63,9 @@ def test_hybridization_profile_output_single_resource():
hwp,
) = h.profiles.values()
h_meta = h.hybrid_meta
h_idx = np.where(h_meta[SupplyCurveField.SC_POINT_GID] == sc_point_gid)[0][0]
h_idx = np.where(
h_meta[SupplyCurveField.SC_POINT_GID] == sc_point_gid
)[0][0]

assert np.allclose(hp[:, h_idx], weighted_solar)
assert np.allclose(hsp[:, h_idx], weighted_solar)
Expand Down

0 comments on commit ce68fec

Please sign in to comment.