thirdwave

Github Mirror

Natural Disasters

Fires

Data comes from FIRMS, Fire Information for Resource Management System, I read their MODIS CSV dataset for the world, for all fires within last 7 days and filter out fires below a certain brightness threshold. MODIS works through satellite images, it scans for certain brighness, color on all Earth images.

import impl as u

u.modis_fire(0,0,18)
plt.savefig('fires.jpg',quality=40)

History

Annual count for worldwide fires; based on FIRMS data, go to Country Yearly Summary [.csv] page and download.. modis_[year]_all_countries.zip for the year you are interested in. Based on select years, the code below scans all countries, counts number of fire (pixels) above a certain brightness threshold.

import pandas as pd, zipfile, datetime
THRESHOLD = 450.0
count = 0
for y in [2000,2005,2010,2015,2020]:
    with zipfile.ZipFile('modis_%d_all_countries.zip' % y, 'r') as z:
          zfiles =  z.namelist()
          for zf in zfiles:
              if ".csv" not in zf: continue
              df =  pd.read_csv(z.open(zf))
              df = df[df.brightness > THRESHOLD]
              count += len(df)          
    print (y, ":", count)
2000 : 144
2005 : 4100
2010 : 7533
2015 : 11607
2020 : 16365
2021 : 23078

Earthquake Stats

Global Fault Lines

Data

Code

Output - Download HTML

Monthly Report

Monthly earthquake counts (greater than 5.0 in mag) since 2013.

import equake, pandas as pd

df = equake.get_eq_all()
df['YM'] = df.apply(lambda x: "%d%02.0f" % (x.name.year,x.name.month), axis=1)
grp = df.groupby("YM").size()
dfp = pd.DataFrame()
dfp['monc'] = grp
dfp['ma'] = grp.rolling(window=20).mean()
dfp = dfp.interpolate(method ='linear', limit_direction ='backward')
dfp.columns = ['Monthly Eqs','MA']
dfp.plot()
plt.savefig('moneq.png')

Region

import equake; equake.eq_region(34,35)

Output