In [1]:
# Ensure I don't use any local plugins. Set it to a readable folder with no Python files to avoid warnings.
%env CIS_PLUGIN_HOME=/Users/watson-parris/Pictures
CIS has it's own version of the Iris Cube. But it's designed to work with any observational data. The CIS data structure is just called UngriddedData:
First unzip your example data to a folder you can easily find it.
In [2]:
from cis import read_data, read_data_list, get_variables
get_variables('../resources/WorkshopData2016/Aeronet/920801_150530_Brussels.lev20')
Out[2]:
In [3]:
aeronet_aot_500 = read_data("../resources/WorkshopData2016/Aeronet/920801_150530_Brussels.lev20", "AOT_500")
print(aeronet_aot_500)
In [4]:
aeronet_aot_500.name()
Out[4]:
In [5]:
%matplotlib inline
In [6]:
aeronet_aot_500.plot()
Out[6]:
In [7]:
ax = aeronet_aot_500.plot(color='red')
ax.set_yscale('log')
In [8]:
aeronet_aot = read_data_list("../resources/WorkshopData2016/Aeronet/920801_150530_Brussels.lev20",
['AOT_500', 'AOT_675'])
ax = aeronet_aot.plot()
In [9]:
ax.set_title('Brussels Aeronet AOT')
ax.set_xlabel('Date')
Out[9]:
In [10]:
from datetime import datetime
ax.set_xlim(datetime(2007,5,5), datetime(2007,8,26))
Out[10]:
In [11]:
aeronet_aot.plot(how='comparativescatter')
# Note that this will only work if we have two datasets in our list
Out[11]:
CIS is able to subset
datasets across any of the given coordinates
In [12]:
aeronet_aot_2007 = aeronet_aot.subset(t=[datetime(2007,1,1), datetime(2007,12,31)])
aeronet_aot_2007
Out[12]:
In [13]:
aeronet_aot_2007.plot(how='comparativescatter')
Out[13]:
In [14]:
model_aod = read_data("../resources/WorkshopData2016/od550aer.nc", "od550aer")
In [15]:
print(model_aod)
In [16]:
import iris.analysis
maod_global_mean, = model_aod.collapsed(['longitude', 'latitude'], iris.analysis.MEAN)
In [17]:
print(maod_global_mean)
In [18]:
ax = maod_global_mean.plot(itemwidth=2)
In [19]:
aeronet_aot_500.plot(ax=ax)
Out[19]:
In [20]:
number_concentration = read_data('../resources/WorkshopData2016/ARCPAC_2008',
'NUMBER_CONCENTRATION')
print(number_concentration)
In [21]:
ax = number_concentration.plot()
In [22]:
ax.bluemarble()
In [23]:
aerosol_cci = read_data('../resources/WorkshopData2016/AerosolCCI',
'AOD550')
aerosol_cci.plot()
Out[23]:
In [24]:
aerosol_cci_one_day = read_data('../resources/WorkshopData2016/AerosolCCI/20080415*.nc',
'AOD550')
ax = aerosol_cci_one_day.plot()
In [25]:
aerosol_cci_one_day.plot(projection='Orthographic')
Out[25]:
In [26]:
ax=aerosol_cci_one_day.plot(projection='InterruptedGoodeHomolosine')
ax.bluemarble()
Given a set of UngriddedData...
... we can perform an aggregation over a specified grid...
... to create a new GriddedData object (which is essentiall an Iris Cube)
In [27]:
gridded_aerosol_cci_one_day = aerosol_cci_one_day.aggregate(x=[-180,180,10], y=[-90,90,5])
In [28]:
gridded_aerosol_cci_one_day[0].plot()
Out[28]:
1. Read in AOD550
and AOD670
from the 5 days of satellite data
In [ ]:
2. Subset this data down to the region covered by the aircraft data
In [ ]:
3. Try plotting AOD550
against AOD670
from the subsetted satellite data using a comparative scatter plot
In [ ]:
This is an gridded onto un-gridded collocation and can be done using either linear interpolation or nearest neighbour.
This is very quick and in general CIS can even handle hybrid height coordinates:
In [29]:
# Lets take a closer look at the model data
print(model_aod)
In [30]:
from cis.time_util import PartialDateTime
# First subset the aeronet data:
aeronet_aot_2008 = aeronet_aot_500.subset(t=PartialDateTime(2008))
Note that we don’t actually have to do this subsetting, but that otherwise CIS will interpolate the nearest values, which in this case we don’t really want.
In [31]:
# Now do the collocation:
model_aod_onto_aeronet = model_aod.collocated_onto(aeronet_aot_2008)
In [32]:
print(model_aod_onto_aeronet[0])
Note the updated history
In [33]:
from cis.plotting.plot import multilayer_plot, taylor_plot
ax = multilayer_plot([model_aod_onto_aeronet[0], aeronet_aot_2008],
layer_opts=[dict(label='Model'),
dict(label='Aeronet')], xaxis='time',
itemwidth=1)
In [34]:
taylor_plot([aeronet_aot_2008, model_aod_onto_aeronet[0]],
layer_opts=[dict(label='Aeronet'),dict(label='Model')])
Out[34]:
In [35]:
# Basic maths on the data
print(model_aod_onto_aeronet[0] - aeronet_aot_2008)
As you can see the difficulty here is the sparseness of the aircraft data, and actually of the satellite data in this region.
This is an ungridded to ungridded collocation:
In [36]:
# Read all of the AOD satelite variables
aerosol_cci = read_data_list('../resources/WorkshopData2016/AerosolCCI', 'AOD*0')
aoerosol_cci_Alaska = aerosol_cci.subset(x=[-170,-100],y=[35,80])
In [37]:
print(aerosol_cci)
In [38]:
aoerosol_cci_Alaska[0].plot(yaxis='latitude')
Out[38]:
In [39]:
aerosol_cci_collocated = aoerosol_cci_Alaska.collocated_onto(number_concentration,
h_sep=10, t_sep='P1D')
In [40]:
aerosol_cci_collocated.append(number_concentration)
print(aerosol_cci_collocated)
In [41]:
aerosol_cci_collocated = aerosol_cci_collocated[::3]
In [42]:
aerosol_cci_collocated[:2].plot('comparativescatter')
Out[42]:
1. How does the correlation change if we only include those average number concentrations which averaged more than one point?
2. Consider the case of comparing our model AOD with the AerosolCCI.
a. What strategies could you employ?
b. Perform an initial assesment of the model AOD field using the Aerosol CCI data for the few days we have data.
In [43]:
df = aerosol_cci_collocated.as_data_frame()
print(df)
In [44]:
df.corr()
# Then do a pretty plot of it...
# This is a nice segway into the Pandas lesson.
Out[44]:
In [45]:
# Save the collocation output so that we can come back to it during the Pandas tutorial.
aerosol_cci_collocated.save_data('col_output.nc')
In [ ]: