Git Product home page Git Product logo

Comments (6)

benbovy avatar benbovy commented on June 3, 2024 1

It should work with version 2022.3.0.

from fastscape.

benbovy avatar benbovy commented on June 3, 2024

Hi Jean,

Thanks for the report.

It looks like xarray-simlab needs to be updated in order to be fully compatible with the last version(s) of Xarray. Which version of Xarray do you use (i.e., output of xr.__versions__)? I could reproduce the issue with version 2022.12.0. I guess Xarray has been updated as well when updating your environment.

In the meantime, for your example here is a workaround (working with Xarray version 2022.12.0):

with basic_model, xs.monitoring.ProgressBar():
    ds_out = (
        ds_in
        .stack(batch=['U','K'])
        .drop_indexes(["batch", "U", "K"])    # explicitly drop the multi-index 
        .drop_vars("batch")                   # remove the batch dimension coordinate
        .xsimlab.run(
            check_dims='transpose',
            store=zgroup,
            batch_dim='batch',
            parallel=True,
            scheduler='processes',
        )
        .set_index(batch=["U", "K"])          # explicitly set the multi-index
        .unstack("batch")
    )

Alternatively, you could define dimensions that corresponds to the parameter variables (so that you can use those parameter values as Xarray coordinates!):

ds_in = xs.create_setup(
    input_vars={
        'uplift__rate': ('uplift__rate', [1e-4,1e-3]),
        'spl__k_coef': ('spl__k_coef', [1e-6,1e-5]),
        ...
    },
)

And then

with basic_model, xs.monitoring.ProgressBar():
    ds_out = (
        ds_in
        .stack(batch=['uplift__rate', 'spl__k_coef'], create_index=False)    # do not create an index
        .xsimlab.run(
            check_dims='transpose',
            store=zgroup,
            batch_dim='batch',
            parallel=True,
            scheduler='processes',
        )
        .set_index(batch=["uplift__rate", "spl__k_coef"])           # explicitly set the multi-index
        .unstack("batch")
    )

from fastscape.

jeanbraun avatar jeanbraun commented on June 3, 2024

Hello @benbovy . Thanks. I have version 2022.12.0 too. I'll use your workaround. Can I get it to work if I downgrade array? To which version?

from fastscape.

jeanbraun avatar jeanbraun commented on June 3, 2024

Thanks

from fastscape.

benbovy avatar benbovy commented on June 3, 2024

Re-opening as we should make it work with last versions of Xarray.

from fastscape.

benbovy avatar benbovy commented on June 3, 2024

Closing as this should be fixed upstream: xarray-contrib/xarray-simlab#193

from fastscape.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.