Package: argopandas
argopandasThe goal of argopandas is to provide seamless access to Argo NetCDF files using a pandasDataFrame-based interface. It is a Python port of theargodata package for R. The package is under heavy development and we would love feedback on the interface or anything else about the package!InstallationYou can install theargopandaspackage usingpip.pipinstallargopandasThe package depends onpandas,numpy,netCDF4, andpyarrow, which install automatically if usingpipor you can install also your favourite Python package manager. Theargopandaspackage requires Python 3.6 or later.ExamplesThe intended interface for most usage is contained in theargopandasmodule. You can import this asargofor pretty-looking syntax:importargopandasasargoThe global indexes are available viaargo.prof,argo.meta,argo.tech,argo.traj,argo.bio_prof,argo.synthetic_prof, andargo.bio_traj.argo.meta.head(5)fileprofiler_typeinstitutiondate_update0aoml/13857/13857_meta.nc845AO2018-10-11 20:00:14+00:001aoml/13858/13858_meta.nc845AO2018-10-11 20:00:15+00:002aoml/13859/13859_meta.nc845AO2018-10-11 20:00:25+00:003aoml/15819/15819_meta.nc845AO2018-10-11 20:00:16+00:004aoml/15820/15820_meta.nc845AO2018-10-11 20:00:18+00:00By defaut, downloads are lazily cached from theIfremer https mirror. You can useargo.url_mirror()orargo.file_mirror()withargo.set_default_mirror()to pointargopandasat 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.levelsaccessor from theargo.profindex:argo.prof.head(5).levels[['PRES','TEMP']]Downloading 5 files from 'https://data-argo.ifremer.fr/dac/aoml/13857/profiles'
Reading 5 filesPRESTEMPfileN_PROFN_LEVELSaoml/13857/profiles/R13857_001.nc0011.90000022.235001117.00000021.987000222.10000021.891001327.20000121.812000432.29999921.632000...............aoml/13857/profiles/R13857_005.nc0102976.5000004.527000103986.7000124.527000104996.7999884.5330001051007.0000004.4870001061017.2000124.471000551 rows × 2 columnsYou 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.infoaccessor that contains length-one variables that aren't aligned along any dimensionsargo.prof:argo.prof.levels,arog.prof.prof,argo.prof.calib,argo.prof.param, andargo.prof.historyargo.traj:argo.traj.cycle,argo.traj.measurement,argo.traj.param, andargo.traj.historyargo.tech:argo.tech.tech_paramargo.meta:argo.meta.config_param,argo.meta.missions,argo.meta.trans_system,argo.meta.positioning_system,argo.meta.launch_config_param,argo.meta.sensor, andargo.meta.paramOnce you have a data frame you do anything you'd do with a regularpd.DataFrame(), like plot your data using the built-in plot method:importmatplotlib.pyplotaspltfig,ax=plt.subplots()forlabel,dfinargo.prof.head(5).levels.groupby('file'):df.plot(x='TEMP',y='PRES',ax=ax,label=label)ax.invert_yaxis()Reading 5 filesYou can access all the index files for a particular float usingargo.float(), which lazily filters all the indexes for a particular float ID.float_obj=argo.float(13857)float_obj.meta.infoDownloading '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 fileDATA_TYPEFORMAT_VERSIONHANDBOOK_VERSIONDATE_CREATIONDATE_UPDATEPLATFORM_NUMBERPTTPLATFORM_FAMILYPLATFORM_TYPEPLATFORM_MAKER...LAUNCH_QCSTART_DATESTART_DATE_QCSTARTUP_DATESTARTUP_DATE_QCDEPLOYMENT_PLATFORMDEPLOYMENT_CRUISE_IDDEPLOYMENT_REFERENCE_STATION_IDEND_MISSION_DATEEND_MISSION_STATUSfileaoml/13857/13857_meta.nc0Argo meta-data3.11.220181011200014201810112000141385709335                                         ...FLOAT                                         ...PALACEWRC                                           ......b'1'19970719163000b'1'19970719103000b'1'R/V Seward Johnson97-03CTD 108                                       ...NaN1 rows × 43 columns