Created
December 3, 2018 17:09
-
-
Save poplarShift/078ab6645c23597323cebe1cddd93efc to your computer and use it in GitHub Desktop.
Reading ODV ("Ocean Data View") data formats into python/pandas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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