Skip to content

Instantly share code, notes, and snippets.

@ajford
Last active March 8, 2017 21:36
Show Gist options
  • Save ajford/2814e5a266c4e6e6129a7e89b4b27132 to your computer and use it in GitHub Desktop.
Save ajford/2814e5a266c4e6e6129a7e89b4b27132 to your computer and use it in GitHub Desktop.
Ulmo CPC year issue (ulmo-dev/ulmo #144)
import ulmo
import pandas as pd
from datetime import date
pd.set_option("display.max_rows",16)
start_date = date(2016,1,1)
end_date = date.today()
df = ulmo.cpc.drought.get_data(state='TX',as_dataframe=True,
start=start_date, end=end_date)
print "-- Tail of dataframe --"
print df[['state','climate_division','period','cmi']].tail()
print "\n-- Last two records are identical (except date is shifted) --\n"
print df[df.cmi==0.12].tail()
$ python demo.py
-- Tail of dataframe --
state climate_division period cmi
625 TX 6 2017-03-05/2017-03-11 2.34
626 TX 7 2017-03-05/2017-03-11 2.78
627 TX 8 2017-03-05/2017-03-11 3.20
628 TX 9 2017-03-05/2017-03-11 0.13
629 TX 10 2017-03-05/2017-03-11 0.12
-- Last two records are identical (except date is shifted) --
state climate_division period precipitation \
236 TX 3 2016-12-04/2016-12-10 0.19
407 TX 6 2017-02-26/2017-03-04 0.23
556 TX 9 2016-12-18/2016-12-24 0.06
568 TX 10 2016-03-06/2016-03-12 2.10
629 TX 10 2017-03-05/2017-03-11 2.10
temperature potential_evap runoff soil_moisture_upper \
236 42.4 0.05 0 1.00
407 56.7 0.29 0 0.94
556 54.9 0.15 0 0.59
568 71.2 0.70 0 1.00
629 71.2 0.70 0 1.00
soil_moisture_lower pdsi cmi
236 2.59 2.73 0.12
407 3.57 2.58 0.12
556 2.14 3.13 0.12
568 2.61 4.14 0.12
629 2.61 4.14 0.12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment