Last active
August 27, 2021 16:36
-
-
Save mattharrison/c67ae9ef82fb7ff9b3fd9a103f4d203a to your computer and use it in GitHub Desktop.
Load nino dataset
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
# Data transformation from previous notebook | |
# col names in tao-all2.col from website | |
names = '''obs | |
year | |
month | |
day | |
date | |
latitude | |
longitude | |
zon.winds | |
mer.winds | |
humidity | |
air temp. | |
s.s.temp.'''.split('\n') | |
nino = pd.read_csv('data/tao-all2.dat.gz', sep=' ', names=names, na_values='.', | |
parse_dates=[[1,2,3]]) | |
nino.columns = [x.replace('.', '_').replace(' ', '_') for x in nino.columns] | |
nino['air_temp_F'] = nino.air_temp_ * 9/5 + 32 | |
wind_cols = [x for x in nino.columns if x.endswith('winds')] | |
for c in wind_cols: | |
nino['{}_mph'.format(c)] = nino[c] * 2.237 | |
pd.to_datetime(nino.date, format='%y%m%d') | |
nino = nino.drop('obs', axis=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is a more modern version
zonal winds (west<0, east>0), meridional winds (south<0, north>0),