Skip to content

Instantly share code, notes, and snippets.

@poplarShift
Created December 3, 2018 17:09
Show Gist options
  • Save poplarShift/078ab6645c23597323cebe1cddd93efc to your computer and use it in GitHub Desktop.
Save poplarShift/078ab6645c23597323cebe1cddd93efc to your computer and use it in GitHub Desktop.
Reading ODV ("Ocean Data View") data formats into python/pandas
# CASE 1: 'ODV.nc' exported from ODV.
import xarray as xr
ds = xr.open_dataset('ODV.nc')
ds.rename({v: ds[v].long_name for v in ds if hasattr(ds[v], 'long_name')})
# CASE 2: 'ODV.txt' in the tabular ODV text format.
import pandas as pd
pd.read_csv('ODV.txt', skiprows=7, header=[0], sep='\t', encoding = "ISO-8859-1”)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment