Skip to content

xarray bump from 2023.10.1 fails tests #183

@brews

Description

@brews

Failure in dependabot PR #174. I'm not sure if the issue is with dscim or the new xarray 2023.11.0 release.

I could use someone's help triaging this and confirming what the issue is.

There is one failing test. Looks like an issue with "OECD Env-Growth" vs "OECD Env-" when it compares coordinates. The full error message from CI:

=================================== FAILURES ===================================
_______________________ test_concatenate_energy_damages ________________________

tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_concatenate_energy_damage0')
econvars_fixture = <dscim.menu.simple_storage.EconVars object at 0x7fb21566ceb0>
energy_in_netcdf_fixture = None

    def test_concatenate_energy_damages(
        tmp_path,
        econvars_fixture,
        energy_in_netcdf_fixture,
    ):
        """
        Test that concatenate_energy_damages correctly concatenates separate energy damages by batches across SSP-RCP-GCM-IAMs and saves to separate netcdf file by batches
        """
        concatenate_energy_damages(
            input_path=os.path.join(tmp_path, "energy_in_netcdf"),
            save_path=tmp_path,
            ec_cls=econvars_fixture,
        )
    
        batch = ["batch" + str(i) for i in range(0, 15)]
    
        for b in batch:
            ds_out_expected = xr.Dataset(
                {
                    "histclim_rebased": (
                        ["batch", "rcp", "gcm", "model", "ssp", "region", "year"],
                        np.float32(np.full((1, 2, 2, 2, 2, 2, 2), 2 * 1.273526)),
                    ),
                    "delta_rebased": (
                        ["batch", "rcp", "gcm", "model", "ssp", "region", "year"],
                        np.float32(np.full((1, 2, 2, 2, 2, 2, 2), 2 * 1.273526)),
                    ),
                },
                coords={
                    "batch": (["batch"], [b]),
                    "rcp": (["rcp"], ["rcp45", "rcp85"]),
                    "gcm": (["gcm"], ["ACCESS1-0", "GFDL-CM3"]),
                    "model": (["model"], ["IIASA GDP", "OECD Env-Growth"]),
                    "ssp": (["ssp"], ["SSP2", "SSP3"]),
                    "region": (["region"], ["USA.test_region", "ZWE.test_region"]),
                    "year": (["year"], [2010, 2099]),
                },
            )
    
>           xr.testing.assert_equal(
                ds_out_expected,
                xr.open_dataset(os.path.join(tmp_path, f"rebased_{b}.nc4")),
            )
E           AssertionError: Left and right Dataset objects are not equal
E           
E           Differing coordinates:
E           L * model             (model) <U15 'IIASA GDP' 'OECD Env-Growth'
E           R * model             (model) <U9 'IIASA GDP' 'OECD Env-'

tests/test_input_damages.py:875: AssertionError

This is from this run.

Archived log from the failed CI run is here: logs_689.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions