Skip to main content

Helper to download and subset sparse data that has been Arcoified and are available through STAC and sqlite formated data

Project description

arcosparse: A Python library for ARCO sparse datasets subsetting

[!WARNING] This library is still in development. Breaking changes might be introduced from version 0.y.z to 0.y+1.z.

Usage

Main functions

arcosparse.subset_and_return_dataframe

Subset the data based on the input and return a dataframe.

arcosparse.subset_and_save

Subset the data based on the input and return data as a partitioned parquet file. It means that the data is saved in one folder and in this folder there are many small parquet files. Though, you can open all the data at once.

To open the data into a dataframe, use this snippet:

import glob

output_path = "some_folder" 

# Get all partitioned Parquet files
parquet_files = glob.glob(f"{output_path}/*.parquet")

# # Read all files into a single dataframe
df = pd.concat(pd.read_parquet(file) for file in parquet_files)

arcosparse.get_entities

A function to get the metadata about the entities that are available in the dataset. Since all the information is retrieved from the metadata, the argument is the url_metadata, the same used for the subset. Returns a list of Entity: class that can be easily imported from the arcosparse module from arcosparse import Entity. It contains information about the entities available in the dataset:

  • entity_id: same as the entity_id column in the result of a subset.
  • entity_type: same as the entity_type column in the result of a subset.
  • doi: the DOI of the entity.
  • institution: the institution associated with the entity.

Changelog

0.4.0

Breaking Changes

  • Deleted function get_entities_ids. Use get_entities as a replacement. Example:
# old code
my_entities = get_entities_ids(url_metadata)

# new code
my_entities = [entity.entity_id for entity in get_entities(url_metadata)]

New features

  • Added function get_entities. It returns a list of Entity objects.

Bug fixes

  • Fix a bug where arcosparse would modify the dict that users input in the columns_rename argument. Now, it deepcopy it to modify it after that.

0.3.5

  • Return all the columns even if full of NaNs.

0.3.4

  • Deleted deprecated get_platforms_names function
  • Fix an issue when query on the chunk would not be correct if the requested subset is 0.

0.3.3

  • Add GPLv3 license

0.3.2

  • Fixes an issue on Windows where deleting a file is not permited if we don't close explicitly the sql connection.

0.3.1

  • Reindex when concatenate. Fixes issue when indexes wouldn't be unique.
  • Fixes an issue on Windows where datetime.to_timestamp does not support dates before 1970-1-1 (i.e. negative values for timestamps).
  • Fixes an issue on Windows where a temporary sqlite file cannot be opened while it's already open in the process.

0.3.0

  • Change columns output: from "platform_id" to "entity_id" and from "platform_type" to "entity_type".
  • Document the expected column names in the doc of the functions.
  • Add columns_rename argument to subset_and_return_dataframe and subset_and_save to be able to choose the names of the columns in the output.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arcosparse-0.4.0.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arcosparse-0.4.0-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file arcosparse-0.4.0.tar.gz.

File metadata

  • Download URL: arcosparse-0.4.0.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.3 Linux/6.11.0-1012-azure

File hashes

Hashes for arcosparse-0.4.0.tar.gz
Algorithm Hash digest
SHA256 645b50e547f241be4960be8196af4cda5887cf3642e2c38233bf9942932c5df9
MD5 495e623cd35a38e364102ac2b2e5d228
BLAKE2b-256 364bab11a9faabe4cd18abf83112dce568a4f3a69f897dd927440219a84bfdbe

See more details on using hashes here.

File details

Details for the file arcosparse-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: arcosparse-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.3 Linux/6.11.0-1012-azure

File hashes

Hashes for arcosparse-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8801ad5a2ac539778cbadc439fb0c712aff88537761879c885f69322c3b8c930
MD5 8712bb1d32d6e6509700274c73de906c
BLAKE2b-256 17acf22b17846ecb1b7d828297d3a809527fa16841d324988fdfced870a9a20f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page