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

Dimension name change with concat_input_dims is a side effect #164

Open
cmdupuis3 opened this issue Jan 20, 2023 · 3 comments
Open

Dimension name change with concat_input_dims is a side effect #164

cmdupuis3 opened this issue Jan 20, 2023 · 3 comments

Comments

@cmdupuis3
Copy link

What is your issue?

Title. The problem is that changing dimension names makes it difficult for the user to index into batched arrays in a batch loop. This is particularly annoying because changing the value of concat_input_dims will change this behavior, sometimes appending _input, sometimes not, which makes debugging and experimentation difficult. I view this as an unwelcome side effect, and I'd prefer the non-batched dimensions keep their original names.

@cmdupuis3
Copy link
Author

Hey @maxrjones, does this serve any purpose? It's incredibly annoying to get through batch generation only to crash because I forgot to rename the dimensions I'm subsetting.

@cmdupuis3
Copy link
Author

Partial example:


    bgen = xb.BatchGenerator(
        ds,
        {'nlon':nlons,       'nlat':nlats},
        concat_input_dims=True
    )

    sub = {'nlon':range(halo_size,nlons-halo_size),
           'nlat':range(halo_size,nlats-halo_size)}

    for batch in bgen:
        batch_input  = [batch[x][sub] for x in ['SSH', 'SST']]

This will crash because the names of batch_input's dimensions are now nlon_input and nlat_input, but if concat_input_dims=False the dim names stay the same.

@cmdupuis3
Copy link
Author

Just learned that xarray rolling adds "_input" (or something similar) also, and it's used to distinguish between the original dimensions (which may still exist) and the new stencil dims.

I'm thinking that this looks superfluous in xbatcher because (at least in my case) the original dimensions are always stacked. Maybe "_input" makes sense if they aren't stacked?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant