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

Custom Grid Vars & Extra Variables for llcreader #308

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

timothyas
Copy link
Member

This implements two things:

  1. Within the core mds_store: allow a user to add "on-the-fly" grid variables, or really any meta/data pair that does not have a 10 digit iteration number. For example, if we have a file smooth2Dnorm001.meta/data in our run_directory:
custom_grid_vars = {'smooth3Dnorm001': {
    'dims': ['k', 'j', 'i'], 
    'attrs': {
        'standard_name': 'normalization_factor',
        'long_name': 'WC01 normalization factor',
        }
    }
}
ds = open_mdsdataset(run_dir, grid_dir, ..., custom_grid_variables=custom_grid_vars)
  1. For llcreader, add this capability and modified open_mdsdataset to add extra_variables #205 to add extra_variable meta information to an llcmodel, e.g.
fs = LocalFileSystem()
store = llcreader.BaseStore(fs, base_path=data_dir, grid_path=grid_dir)
model = llcreader.LLC90Model(store)
ds = model.get_dataset(varnames=['smooth3Dnorm001'], extra_variables=custom_grid_vars, ...)

@cspencerjones: Hopefully with this PR my comment to #307 makes more sense. You could use this to add your SSU/SSV variables on-the-fly as with the extra_variables capability for mds_store. The only issue is if those SSU/SSV files are on a different grid, things will get more complicated, but if they're on the global grid this should work no problem.

I'll keep this as a draft for now because I need to add tests.

@timothyas timothyas marked this pull request as draft June 27, 2022 15:39
@timothyas
Copy link
Member Author

timothyas commented Aug 5, 2022

Tests currently fail due to the issue described in #312. They do pass when the pytest fixture scope is set to "function", as described in that issue.

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

Successfully merging this pull request may close these issues.

1 participant