Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions api-reference/tilebox.datasets/Collection.delete.mdx
Original file line number Diff line number Diff line change
@@ -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.

<Note>
You need to have write permission on the collection to be able to delete datapoints.
</Note>

## Parameters

<ParamField path="datapoints" type="xr.Dataset">
An [`xarray.Dataset`](/sdks/python/xarray) containing an "id" variable consisting of datapoint IDs to delete.
</ParamField>

## Returns

The number of datapoints that were deleted.

<RequestExample>
```python Python
datapoints = collection.load("2023-05-01 12:45:33.423")

n_deleted = collection.delete(datapoints)
```
</RequestExample>
36 changes: 36 additions & 0 deletions api-reference/tilebox.datasets/Collection.delete_ids.mdx
Original file line number Diff line number Diff line change
@@ -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.

<Note>
You need to have write permission on the collection to be able to delete datapoints.
</Note>

## Parameters

<ParamField path="datapoints_ids" type="list[UUID]">
The ids of the datapoints to delete.
</ParamField>

## Returns

The number of datapoints that were deleted.

<RequestExample>
```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)
```
</RequestExample>
75 changes: 75 additions & 0 deletions datasets/ingest-delete-data.mdx
Original file line number Diff line number Diff line change
@@ -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. |

<Note>
You need to have write permission on the collection to be able to ingest or delete datapoints.
</Note>

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.

<CodeGroup>
```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"]
```
</CodeGroup>

## 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.

<CodeGroup>
```python Python
datapoints = collection.load(("2023-05-01", "2023-06-01"))

n_deleted = collection.delete(datapoints)
print(f"Deleted {n_deleted} data points.")
```
</CodeGroup>

```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.

<CodeGroup>
```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.")
```
</CodeGroup>

```plaintext Output
Deleted 2 data points.
```
2 changes: 1 addition & 1 deletion datasets/open-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ By using the [datasets API](/datasets), you can start prototyping your applicati
## Available datasets

<Tip>
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.
</Tip>

### Copernicus Data Space
Expand Down
5 changes: 4 additions & 1 deletion mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"datasets/timeseries",
"datasets/collections",
"datasets/loading-data",
"datasets/ingest-delete-data",
{
"group": "Managed datasets",
"icon": "bars-progress",
Expand Down Expand Up @@ -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"
]
},
{
Expand Down