Beispiel #1
0
def translate_id_v3_to_v2(v3_id: str) -> str:
    """Translates v3 ids to v2 ids"""
    idc = id2 = v3_id.split(".")

    if idc[0].lower() == "nem":
        id2 = id2[1:]

    stat_type = idc[-1]

    if stat_type in ["energy", "power", "market_value", "emissions"]:
        fueltech_old = idc[-2]
        fueltech = map_v3_fueltech(fueltech_old)
        id2 = [idc[1], "fuel_tech", fueltech, stat_type]

    if stat_type in ["temperature", "temperature_mean", "temperature_max"]:
        id2 = [idc[1], idc[-1]]

    return ".".join([i for i in id2 if i])
Beispiel #2
0
    def fueltech_v2(self) -> Optional[str]:
        if self.fuel_tech:
            return map_v3_fueltech(self.fuel_tech)

        return None
Beispiel #3
0
def test_fueltech_map_v3(fueltech: str, fueltech_expected: str) -> None:
    fueltech_mapped = map_v3_fueltech(fueltech)
    assert fueltech_mapped == fueltech_expected