Skip to content

Instantly share code, notes, and snippets.

View parevalo's full-sized avatar

Paulo Arevalo parevalo

  • Boston University
  • Boston
View GitHub Profile
import ee
# Filter collection by point and date
def collection_filtering(point, collection_name, year_range, doy_range):
collection = ee.ImageCollection(collection_name)\
.filterBounds(point)\
.filter(ee.Filter.calendarRange(year_range[0], year_range[1], 'year'))\
.filter(ee.Filter.dayOfYear(doy_range[0],doy_range[1]))
return collection
@parevalo
parevalo / plotter.py
Created July 1, 2019 16:13
Barplots of carbon emissions in Tg C (left) and Mg C /ha (right)
def simple_plotter(df, col_names, net_name, legend, fname):
periods = np.arange(2002, 2016, 2)
# Required, otherwise labels are shifted for some reason.
df['period'] = periods
ax1 = df.plot(x='period', y=col_names, kind='bar', stacked=True,
figsize = FIGSIZE, rot=0, use_index=False)
df.plot(x='period', y=net_name,kind='line', linestyle='-', marker='o',
color='black', ax=ax1, figsize=FIGSIZE, use_index=False, rot=0)
# Required to avoid figure being cut