This Python script provides a command-line interface for uploading stations, observations, and datastreams to a HydroServer. The script uses the httpx
library for making HTTP requests and pandas
for handling CSV data.
- Python 3.x
- Required Python packages:
httpx
,pandas
- Clone the repository:
git clone <repository_url>
cd Hydroserver_cli
- Create the following env:
conda env create -f environment.yaml
To upload stations to a HydroServer, use the following command:
python upload_data.py upload-things <username> <password> <hydroserver_url> <file_path>
<username>
: HydroServer username<password>
: HydroServer password<hydroserver_url>
: HydroServer URL, (Do not put a trailing slash)- **
<file_path>
: **Path to the file containing station information (CSV format)
To upload observations to a HydroServer, use the following command:
python upload_data.py upload-observations <username> <password> <hydroserver_url> <file_path> <date_column> <value_column> <datastream_id>
<username>
: HydroServer username<password>
: HydroServer password<hydroserver_url>
: HydroServer URL (Do not put a trailing slash)<file_path>
: Path to the file containing observation data (CSV format)<date_column>
: Column name for date values<value_column>
: Column name for observation values<datastream_id>
: ID of the datastream to associate the observations with
To delete all stations from a HydroServer, use the following command:
python upload_data.py delete-all-things <username> <password> <hydroserver_url>
<username>
: HydroServer username<password>
: HydroServer password<hydroserver_url>
: HydroServer URL (Do not put a trailing slash)
- Ensure that the required Python packages are installed (
httpx
andpandas
) before running the script. - Make sure to replace
<repository_url>
with the actual URL if you are cloning the repository.
Feel free to modify the script according to your specific needs and requirements.