diff --git a/api-reference/tilebox.datasets/Collection.delete.mdx b/api-reference/tilebox.datasets/Collection.delete.mdx new file mode 100644 index 0000000..43ae441 --- /dev/null +++ b/api-reference/tilebox.datasets/Collection.delete.mdx @@ -0,0 +1,34 @@ +--- +title: Collection.delete +icon: download +--- + +```python +def Collection.delete(datapoints: xr.Dataset) -> int +``` + +Delete datapoints from the collection. + +Datapoints are identified and deleted by their ids. + + + You need to have write permission on the collection to be able to delete datapoints. + + +## Parameters + + + An [`xarray.Dataset`](/sdks/python/xarray) containing an "id" variable consisting of datapoint IDs to delete. + + +## Returns + +The number of datapoints that were deleted. + + +```python Python +datapoints = collection.load("2023-05-01 12:45:33.423") + +n_deleted = collection.delete(datapoints) +``` + diff --git a/api-reference/tilebox.datasets/Collection.delete_ids.mdx b/api-reference/tilebox.datasets/Collection.delete_ids.mdx new file mode 100644 index 0000000..efdfc14 --- /dev/null +++ b/api-reference/tilebox.datasets/Collection.delete_ids.mdx @@ -0,0 +1,36 @@ +--- +title: Collection.delete_ids +icon: download +--- + +```python +def Collection.delete_ids(datapoints_ids: list[UUID]) -> int +``` + +Delete datapoint from the collection by their ids. + + + You need to have write permission on the collection to be able to delete datapoints. + + +## Parameters + + + The ids of the datapoints to delete. + + +## Returns + +The number of datapoints that were deleted. + + +```python Python +from uuid import UUID + +datapoints_ids=[ + UUID("29b29ade-db02-427a-be9c-a8ef8184f544"), + UUID("fa4a8e4e-6afe-41a3-b228-b867330669bd"), +] +n_deleted = collection.delete_ids(datapoints_ids) +``` + diff --git a/datasets/ingest-delete-data.mdx b/datasets/ingest-delete-data.mdx new file mode 100644 index 0000000..1c85149 --- /dev/null +++ b/datasets/ingest-delete-data.mdx @@ -0,0 +1,75 @@ +--- +title: Ingesting and Deleting Data +sidebarTitle: Ingesting and deleting data +description: Learn how to ingest and delete data from Time Series Dataset collections. +icon: download +--- + +## Overview + +This section provides an overview of the API for ingesting and deleting data from a collection. It includes usage examples for many common scenarios. + +| Method | API Reference | Description | +| ----------------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------- | +| `collection.delete` | [Deleting data points](/api-reference/tilebox.datasets/Collection.delete) | Delete data points from a collection. | +| `collection.delete_ids` | [Deleting data points by IDs](/api-reference/tilebox.datasets/Collection.delete_ids) | Delete data points from a collection by their ids. | + + + You need to have write permission on the collection to be able to ingest or delete datapoints. + + +Check out the examples below for common scenarios when ingesting and deleting data from collections. +The examples assume you have already [created a client](/datasets/introduction#creating-a-datasets-client) and [accessed a specific dataset collection](/datasets/collections) that you have write permissions on. + + +```python Python +from tilebox.datasets import Client + +client = Client() +datasets = client.datasets() +collections = datasets.open_data.copernicus.sentinel1_sar.collections() +collection = collections["S1A_IW_RAW__0S"] +``` + + +## Ingesting data + + +## Deleting data + +To delete data from a collection, use the [delete](/api-reference/tilebox.datasets/Collection.delete) or [delete_ids](/api-reference/tilebox.datasets/Collection.delete_ids) method. + +One common way to delete data is to load it from a collection and then forward it to the `delete` method. + + +```python Python +datapoints = collection.load(("2023-05-01", "2023-06-01")) + +n_deleted = collection.delete(datapoints) +print(f"Deleted {n_deleted} data points.") +``` + + +```plaintext Output +Deleted 104 data points. +``` + +In case you already have the list of datapoint IDs that you want to delete, you can use the `delete_ids` method. + + +```python Python +from uuid import UUID + +datapoints_ids=[ + UUID("29b29ade-db02-427a-be9c-a8ef8184f544"), + UUID("fa4a8e4e-6afe-41a3-b228-b867330669bd"), +] + +n_deleted = collection.delete_ids(datapoints_ids) +print(f"Deleted {n_deleted} data points.") +``` + + +```plaintext Output +Deleted 2 data points. +``` diff --git a/datasets/open-data.mdx b/datasets/open-data.mdx index a1e172c..4524270 100644 --- a/datasets/open-data.mdx +++ b/datasets/open-data.mdx @@ -20,7 +20,7 @@ By using the [datasets API](/datasets), you can start prototyping your applicati ## Available datasets - The Tilebox Console contains in-depth descriptions of each dataset, including many code-snippets to help you get started. Check out the [Sentinel 5P Tropomi](https://console.tilebox.com/datasets/descriptions/feb2bcc9-8fdf-4714-8a63-395ee9d3f323) documentation as an example. + The Tilebox Console contains in-depth descriptions of each dataset. Check out the [Sentinel 5P Tropomi](https://console.tilebox.com/datasets/explorer/feb2bcc9-8fdf-4714-8a63-395ee9d3f323?view=documentation) documentation as an example. ### Copernicus Data Space diff --git a/mint.json b/mint.json index 3f7f3f0..7178c93 100644 --- a/mint.json +++ b/mint.json @@ -104,6 +104,7 @@ "datasets/timeseries", "datasets/collections", "datasets/loading-data", + "datasets/ingest-delete-data", { "group": "Managed datasets", "icon": "bars-progress", @@ -163,7 +164,9 @@ "api-reference/tilebox.datasets/Dataset.collection", "api-reference/tilebox.datasets/Collection.info", "api-reference/tilebox.datasets/Collection.load", - "api-reference/tilebox.datasets/Collection.find" + "api-reference/tilebox.datasets/Collection.find", + "api-reference/tilebox.datasets/Collection.delete", + "api-reference/tilebox.datasets/Collection.delete_ids" ] }, {