-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
time dimension #1334
Comments
Yes, many new users of xarray are confused by this one: http://xarray.pydata.org/en/latest/time-series.html#datetime-components |
Aha! I see, but how do I access the data as an integer? I apologise, I'm new and it is not clear from the link how to access this as standard types: hour.time hour.time give the same as above. |
I don't really understand what you mean. Here is the example from the docs again: import xarray as xr
import pandas as pd
import numpy as np
time = pd.date_range('2000-01-01', freq='H', periods=24)
ds = xr.Dataset({'foo': ('time', np.arange(24)), 'time': time})
ds['time.hour'] which prints:
What is it exactly what you are expecting? |
apologies for these rookie questions. What I want is to access the array [0,1,2,3....] as integers, for example. Hope this is a bit clearer. I'm just checking if xarray can be use within my processing chain. Perhaps xr is it something more to plot data, and the objects within xr are only capable of manipulation only within a limited framework. You can close this issue. I can ask this on stackoverflow as this is not truly a bug or the like. |
I strongly disagree with that one of course ;-) Let us now if we can do anything about the documentation in order to improve it. |
Ok. Concrete examples goes a far way. Maybe including this example into the docs might clarify how a user might access the data. I will use xr in the later stages of my work to analyse the data. |
I think this is related to #1282: docs frequently assume users are fluent pandas users, which is not always the case. |
This is true. I find that the Pandas creators assume too many things about the user. Not wanting to imply dumbing down, but users in science come to a module with a specific problem in mind, not to learn the module from scratch. Most of us are quick learners that can handle a steep learning curve if the docs/examples are rich in relevant info (intensive), which need not be long and drawn out. It would have been a better assumption to think that users such as myself are familiar with netCDF4, HDF4, Numpy, rather than the younger modules such as dask, xarray, and pandas, and draw associations from there. |
In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity If this issue remains relevant, please comment here or remove the |
Hi,
I'm new to xarray and would like to use it to process some data. For this task I need to access the time dimension and get the date in terms of year, month, and hour. I can do this if the time variable is a netcdf object but xarray does not return this object type.
For example:
import netcdf4 as nc
idata = nc.Dataset(ifile,'r')
time = idata.variables['time']
dtime = num2date(time[:],time.units)
hour = time[0].hour
How could access the time sub-variables in a similar manner?
The text was updated successfully, but these errors were encountered: