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

Verify_collections assumes the last group will be the dataset with lat and lon #2168

Open
nlenssen2013 opened this issue Feb 6, 2024 · 2 comments

Comments

@nlenssen2013
Copy link
Collaborator

nlenssen2013 commented Feb 6, 2024

lines 341 through 347 needs to be improved to check each group if the lat/lon variable exist. Then read in the nc group into an xarray dataset. Lat and lon var names should be defined before this code block.

with netCDF4.Dataset(subsetted_filepath) as f:
        for g in f.groups:
            ds = xarray.open_dataset(subsetted_filepath, group=g, decode_times=False)
            if len(ds.variables):
                group = g
                subsetted_ds = ds
            else:
                ds.close()

    lat_var_name, lon_var_name = get_lat_lon_var_names(subsetted_ds, collection_variables)
@nlenssen2013
Copy link
Collaborator Author

flattening variables in file is also necessary.

@jamesfwood
Copy link
Contributor

Hi @nlenssen2013
Is this one still an issue? If not, can you close it?
Thanks!

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

2 participants