Helper to download and subset sparse data that has been Arcoified and are available through STAC and sqlite formated data
Maintained. Last release 9 months ago. Weaker on release cadence.
pip install arcosparsearcosparse: A Python library for ARCO sparse datasets subsetting
Disclaimer
It is not recommended to use the arcosparse library directly.
Instead, if you want to work with sparse datasets, use the copernicusmarine Toolbox or tools like earthkit.
Issues on the repository are welcome and we will do our best to answer them.
Usage
[!WARNING] This library is still in development. Breaking changes might be introduced from version
0.y.zto0.y+1.z.
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 arcosparse.Entity. It contains information about the entities available in the dataset:
entity_id: same as theentity_idcolumn in the result of a subset.entity_type: same as theentity_typecolumn in the result of a subset.doi: the DOI of the entity.institution: the institution associated with the entity.institution_edmo_code: the EDMO code of the institution associated with the entity.
arcosparse.get_dataset_metadata
A function to get the metadata about the dataset. Since all the information is retrieved from the metadata, the argument is the , the same used for the subset.