# Generate a list of dates for December of each year from 2000 to 2014
december_dates = pd . date_range ( start = "2000-12-01" , end = "2014-12-01" , freq = "YS-DEC" )
# Subset the dataset to include only these December dates and
# plot the 'deficit' variable across the selected time steps
december_subset = subset . sel ( time = december_dates )
december_subset . time
<xarray.DataArray 'time' (time: 15)> Size: 120B
2000-12-01 2001-12-01 2002-12-01 2003-12-01 ... 2012-12-01 2013-12-01 2014-12-01
Coordinates: (1) 2000-12-01 2001-12-01 2002-12-01 ... 2012-12-01 2013-12-01 2014-12-01
array(['2000-12-01T00:00:00.000000000', '2001-12-01T00:00:00.000000000',
'2002-12-01T00:00:00.000000000', '2003-12-01T00:00:00.000000000',
'2004-12-01T00:00:00.000000000', '2005-12-01T00:00:00.000000000',
'2006-12-01T00:00:00.000000000', '2007-12-01T00:00:00.000000000',
'2008-12-01T00:00:00.000000000', '2009-12-01T00:00:00.000000000',
'2010-12-01T00:00:00.000000000', '2011-12-01T00:00:00.000000000',
'2012-12-01T00:00:00.000000000', '2013-12-01T00:00:00.000000000',
'2014-12-01T00:00:00.000000000'], dtype='datetime64[ns]') Coordinates: (1)
Indexes: (1)
PandasIndex
PandasIndex(DatetimeIndex(['2000-12-01', '2001-12-01', '2002-12-01', '2003-12-01',
'2004-12-01', '2005-12-01', '2006-12-01', '2007-12-01',
'2008-12-01', '2009-12-01', '2010-12-01', '2011-12-01',
'2012-12-01', '2013-12-01', '2014-12-01'],
dtype='datetime64[ns]', name='time', freq=None)) Attributes: (0)