Skip to content

Why time indices are ignored in FieldSet.from_netcdf? #1563

@bbarcelollull

Description

@bbarcelollull

I have a set of netcdf files with a date overlap: the last date of one file is the first date of the next file. I have one file per day and hourly outputs, and instead of having 24 indices per file, I have 25 indices. Because of this, I get an error when creating the fieldset with FieldSet.from_netcdf. To solve this, I need to read only the first 24 indices of each file. However, when doing an easy test like this for only one file:

indices = {'depth': np.arange(2).tolist(),
              'lat': np.arange(2).tolist(), 
              'lon': np.arange(2).tolist(), 
              'time': np.arange(2).tolist()} 

fieldset = FieldSet.from_netcdf(filenames, variables, dimensions, indices, deferred_load=False)

I get the following warning: "WARNING: time dimension in indices is not necessary anymore. It is then ignored."

And the shape of the U field (fieldset.U.data.shape) is (25, 2, 2, 2).

Hence, indices works for all dimensions except for time. Why this happens? Can I force the code to read the time indices?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions