Skip to main content

argopandas

Check Codecov test coverage argopandas on PyPi Documentation argopandas on GitHub

The goal of argopandas is to provide seamless access to Argo NetCDF files using a pandas DataFrame-based interface. It is a Python port of the argodata package for R. The package is under heavy development and we would love feedback on the interface or anything else about the package!

Installation

You can install the argopandas package using pip.

pip install argopandas

The package depends on pandas, numpy, netCDF4, and pyarrow, which install automatically if using pip or you can install also your favourite Python package manager. The argopandas package requires Python 3.6 or later.

Examples

The intended interface for most usage is contained in the argopandas module. You can import this as argo for pretty-looking syntax:

import argopandas as argo

The global indexes are available via argo.prof, argo.meta, argo.tech, argo.traj, argo.bio_prof, argo.synthetic_prof, and argo.bio_traj.

argo.meta.head(5)
file profiler_type institution date_update
0 aoml/13857/13857_meta.nc 845 AO 2018-10-11 20:00:14+00:00
1 aoml/13858/13858_meta.nc 845 AO 2018-10-11 20:00:15+00:00
2 aoml/13859/13859_meta.nc 845 AO 2018-10-11 20:00:25+00:00
3 aoml/15819/15819_meta.nc 845 AO 2018-10-11 20:00:16+00:00
4 aoml/15820/15820_meta.nc 845 AO 2018-10-11 20:00:18+00:00

By defaut, downloads are lazily cached from the Ifremer https mirror. You can use argo.url_mirror() or argo.file_mirror() with argo.set_default_mirror() to point argopandas at your favourite copy of Argo.

To get Argo data from one or more NetCDF files, subset the indexes and use one of the table accessors to download, cache, and read variables aligned along common dimensions. The accessor you probably want is the .levels accessor from the argo.prof index:

argo.prof.head(5).levels[['PRES', 'TEMP']]
Downloading 5 files from 'https://data-argo.ifremer.fr/dac/aoml/13857/profiles'
Reading 5 files
PRES TEMP
file N_PROF N_LEVELS
aoml/13857/profiles/R13857_001.nc 0 0 11.900000 22.235001
1 17.000000 21.987000
2 22.100000 21.891001
3 27.200001 21.812000
4 32.299999 21.632000
... ... ... ... ...
aoml/13857/profiles/R13857_005.nc 0 102 976.500000 4.527000
103 986.700012 4.527000
104 996.799988 4.533000
105 1007.000000 4.487000
106 1017.200012 4.471000

551 rows × 2 columns

You can get data from every variable in an Argo NetCDF file using one of these accessors. The variables grouped in each are aligned along the same dimensions and are documented together in the Argo user's manual.

  • All indexes have a .info accessor that contains length-one variables that aren't aligned along any dimensions
  • argo.prof: argo.prof.levels, arog.prof.prof, argo.prof.calib, argo.prof.param, and argo.prof.history
  • argo.traj: argo.traj.cycle, argo.traj.measurement, argo.traj.param, and argo.traj.history
  • argo.tech: argo.tech.tech_param
  • argo.meta: argo.meta.config_param, argo.meta.missions, argo.meta.trans_system, argo.meta.positioning_system, argo.meta.launch_config_param, argo.meta.sensor, and argo.meta.param

Once you have a data frame you do anything you'd do with a regular pd.DataFrame(), like plot your data using the built-in plot method:

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
for label, df in argo.prof.head(5).levels.groupby('file'):
    df.plot(x='TEMP', y = 'PRES', ax=ax, label=label)
ax.invert_yaxis()
Reading 5 files

You can access all the index files for a particular float using argo.float(), which lazily filters all the indexes for a particular float ID.

float_obj = argo.float(13857)
float_obj.meta.info
Downloading 'https://data-argo.ifremer.fr/ar_index_global_meta.txt.gz'
Downloading 'https://data-argo.ifremer.fr/dac/aoml/13857/13857_meta.nc'
Reading 1 file
DATA_TYPE FORMAT_VERSION HANDBOOK_VERSION DATE_CREATION DATE_UPDATE PLATFORM_NUMBER PTT PLATFORM_FAMILY PLATFORM_TYPE PLATFORM_MAKER ... LAUNCH_QC START_DATE START_DATE_QC STARTUP_DATE STARTUP_DATE_QC DEPLOYMENT_PLATFORM DEPLOYMENT_CRUISE_ID DEPLOYMENT_REFERENCE_STATION_ID END_MISSION_DATE END_MISSION_STATUS
file
aoml/13857/13857_meta.nc 0 Argo meta-data 3.1 1.2 20181011200014 20181011200014 13857 09335 ... FLOAT ... PALACE WRC ... ... b'1' 19970719163000 b'1' 19970719103000 b'1' R/V Seward Johnson 97-03 CTD 108 ... NaN

1 rows × 43 columns

Metadata

Release files for argopandas 0.0.5

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

Source distribution (sdist)

Source distribution for argopandas 0.0.5
File Size Uploaded Provenance
argopandas-0.0.5.tar.gz 25.5 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 52.6 kB

Release files / argopandas-0.0.5.tar.gz

Download URL argopandas-0.0.5.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0507de8ad3db60f9be39ec76ad6a79cb1f07da3a7dd630b34fde995d570a47ad
BLAKE2b-256 checksum
How to use checksums
3d4c066f133b54bfd3edce6157841bc9eed6f612f779c0cf2ac62af75e0324fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / argopandas-0.0.5-py3-none-any.whl

Download URL argopandas-0.0.5-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0a4915676ef11b8e73f23377db6da0bc8415ad72e1fe9b827919b22e3f7b0cb
BLAKE2b-256 checksum
How to use checksums
f68d03635a15ec67876a7a66e9f42927a1fcf8529240bc990c9d474a5e1baaa9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Security for argopandas 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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