-
Notifications
You must be signed in to change notification settings - Fork 11
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
Generic import/export function for Obs and ObsCollection classes #124
Comments
You can pickle the ObsCollection/Observations using the I'm all for a generic human-readable export format for Observations. I'd suggest some kind of CSV format that includes some information about its Obs type(?). Then I guess we need to the define some kind of header format and then write the time series data below that. If we want to attempt to maintain data types on import, that will be a bit of a challenge. An ObsCollection could then just use that Observation export format to write CSV files for each Observation in the collection. If anyone else has any suggestions regarding this topic, feel free to post them here. |
Thank you David, this answers my question. After reading back the pickled object, I even get an ObsCollection object instead of the DataFrame I had expected. Magic still happens, apparently. |
Hahaha, I had the same first reaction when the There is also a |
Maybe we can create a simple |
I've added a |
Rather than open a new issue, I feel it fits better here.
I would like to export and ObsCollection as a HydroMonitor Format. It's a format that fits the above wishes, is used quite widely and is easily human readable. Is this a feature you would consider adding to HydroPandas, or maybe it is already possible? At the moment HydroPandas is an amazing tool to use and saves me quite a lot of time. However when I need to get the data out of a python environment I struggle to find the best way. I have however managed to get an ObsCollection to IPF conversion working. |
Hi @TomHottentot, Glad to hear you enjoy using hydropandas! As for extra export functionality, we'd absolutely welcome contributions to export ObsCollections to IPF files or HydroMonitor files. This is not something we're likely to implement ourselves soon as we haven't run into a need for that as of yet and we're quite busy at the moment, but we're open to contributions from others! So if you feel comfortable to add Let us know if any of the above options work for you? I'll reopen this issue as a reminder for this work. |
Hi, @dbrakenhoff I would be happy to give it a go, but I'm still quite new to both python and github, so it might take a while. I will start by rewriting my to_ipf python code to a function. If I get that working I'll try the hydromonitor as well. |
Hi @TomHottentot, no worries, feel free to post your code/or questions here if you have any questions or could use some help. Once you have it in function form, and the data in pandas Series or DataFrames, the step to getting it implemented in hydropandas isn't too big :). |
Would it be possible to add a generic import/export functionality to the Obs and ObsCollection classes? This would make temporarily saving of intemediate results easier for users who would like to avoid the technical challenges of setting up a pystore workflow.
Currently, hydropandas supports import of a lot of different external data sources. However, given the creative skills of software developers that seem to invent a new data format every week, unsupported data formats will probably keep on popping up forever. For instance, Hydropandas current version 0.7.3 doesn't seem to support the WaterWeb, Dawaco or HydroMonitor csv export formats.
Fortunately, it is relatively easy for Hydropandas users to write their own import classes and create Obs and ObsCollection instances from raw data files and process their data. However, given the size and format of data files, reading files can take quite some time. In the current Hydropandas version 0.7.3, I can save data to a json format (using the inherited Pandas method), but I can not read this data directly back into a Obs or ObsCollection instance because an import method is missing from the Obs and ObsCollection classes.
Therefore, it would be convenient to be able to import raw data into an Obs or Obscollection class, resample data to a more manageable frequency, and save these intermediate result to a temporarily file that can be read directly using Obs or ObsCollection methods.
The text was updated successfully, but these errors were encountered: