Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xarray bump from 2023.10.1 fails tests #183

Closed
brews opened this issue Dec 5, 2023 · 2 comments
Closed

xarray bump from 2023.10.1 fails tests #183

brews opened this issue Dec 5, 2023 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@brews
Copy link
Member

brews commented Dec 5, 2023

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

@brews brews added the help wanted Extra attention is needed label Dec 5, 2023
@brews brews changed the title CI Tests fail when upgrading bumping xarray from 2023.10.1 xarray bump from 2023.10.1 fails tests Dec 5, 2023
@JMGilbert
Copy link
Contributor

#229 should address this.

@kemccusker
Copy link
Member

Resolved by #229

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants