-
Notifications
You must be signed in to change notification settings - Fork 5
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
merge or remove trajan_from_dictionary to from_dataframe #56
Comments
Yes, I agree. |
That could probably be done with something like:
|
Oh yes, then there should be no use for another method. Though some people are lazy enough to prefer |
and it should also be possible to provide drifter name(s) and variable- and global attributes |
name is already possible to provide. variable and global attributes are better to set using standard xarray methods:
Constructing a dict or passing in attrs in some other way is equally much code or complexity, and we would diverge from the way xarray datasets are used in other contexts. |
I'm not totally opposed to |
Ok, so you suggest to first create the dataset, and then add attributes with separate commands? |
Yes, I don't see how it will simplify things if we have a way to specify attrs anyway. The attributes need to be set up beforehand anyway, now the user just needs to do it after having created the dataset, so the user would have to do the same steps anyway: then it is better to do it directly through xarray and not special arguments. Regarding |
Here's an example/suggestion, also with adding attributes: https://opendrift.github.io/trajan/autoapi/trajan/index.html#constructing-a-dataset-from-arrays-of-postions-and-time |
I think most of the functionality in https://github.com/OpenDrift/trajan/blob/main/trajan/__init__.py#L56 could be done in a simpler way in https://github.com/OpenDrift/trajan/blob/main/trajan/__init__.py#L21. The latter is also missing some attributes to make it completely CF-compatible.
Maybe it is easier to only use
from_dataframe
, as far as I know only sfydata uses the from_dictionary method: https://github.com/gauteh/sfy/blob/main/sfy-processing/sfy/cli/collection.py#L185 and I think that this method could be re-written to use from_dataframe and it would be end up being shorter.This would be a pretty generic method to go from arbitrary tabular data to a CF-compliant trajactory dataset.
The text was updated successfully, but these errors were encountered: