Skip to main content

pastastore Documentation Status Codacy Badge Codacy Badge PyPI

pastastore

This module stores Pastas time series and models in a database.

Storing time series and models in a database allows the user to manage time series and Pastas models on disk, which allows the user to pick up where they left off without having to reload everything.

Installation

Install the module with pip install pastastore.

For development, clone the repository and install all development, testing, and documentation dependencies with:

pip install -e .[dev]

For plotting background maps, the contextily and pyproj packages are required. For a full install, including optional dependencies for plotting and labeling data on maps, use: pip install pastastore[optional] Windows users are asked to install rasterio themselves since it often cannot be installed using pip. rasterio is a dependency of contextily.

Usage

The following snippets show typical usage. The first step is to define a so-called Connector object. This object contains methods to store time series or models to the database, or read objects from the database.

The following code creates a PasConnector, which uses Pastas JSON-styled ".pas-files" to save models in a folder on your computer (in this case a folder called pastas_db in the current directory).

import pastastore as pst

# create connector instance
conn = pst.PasConnector(name="pastas_db", path=".")

The next step is to pass that connector to the PastaStore object. This object contains all kinds of useful methods to analyze and visualize time series, and build and analyze models.

# create PastaStore instance
pstore = pst.PastaStore(conn)

Now the user can add time series, models or analyze or visualize existing objects in the database. Some examples showing the functionality of the PastaStore object are shown below:

import pandas as pd
import pastas as ps

# load oseries from CSV and add to database
oseries = pd.read_csv("oseries.csv")
pstore.add_oseries(oseries, "my_oseries", metadata={"x": 100_000, "y": 400_000})

# read oseries from database
oseries = pstore.get_oseries("my_oseries")

# view oseries metadata DataFrame
pstore.oseries

# plot oseries location on map
ax = pstore.maps.oseries()
pstore.maps.add_background_map(ax)  # add a background map

# plot my_oseries time series
ax2 = pstore.plot.oseries(names=["my_oseries"])

# create a model with pastas
ml = ps.Model(oseries, name="my_model")

# add model to database
pstore.add_model(ml)

# load model from database
ml2 = pstore.get_models("my_model")

# export whole database to a zip file
pstore.to_zip("my_backup.zip")

For more elaborate examples, refer to the Notebooks.

Release files for pastastore 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pastastore 2.0.0
File Size Uploaded
pastastore-2.0.0.tar.gz 101.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pastastore 2.0.0
File Interpreter ABI Platform
pastastore-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 210.8 kB

Release files / pastastore-2.0.0.tar.gz

Download URL pastastore-2.0.0.tar.gz
Size 101.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4cf40a5a64902c0f47d3b9dbef52c9dad3d3ed1241c9a85afb77a9c0d6d07121
BLAKE2b-256 checksum
How to use checksums
d9e3775876e776534059ebb0cdd4ca893f9b62cdc9ec9ea62df8364de1e7ea9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pastastore-2.0.0-py3-none-any.whl

Download URL pastastore-2.0.0-py3-none-any.whl
Size 109.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d3762236b6955e6507f037b2da9d5780ce1654a900bf75c4cc9194ab9241191
BLAKE2b-256 checksum
How to use checksums
9059e8ec0590b5506be32ea88e975cf782b51ee262ef7c2d873358494c126974
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.13.0

2 release files

1.12.0

2 release files

1.10.1

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.2

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page