<jupyter_start><jupyter_text>Session 1**Exercise 1:** Learning to use notebooks1. Launch Jupyter Notebook and create a new notebook2. Rename the notebook3. Create a new cell and use *type()* to see if the following are floats and integers:    * 2+2    * 2\*2.0    * var_float/var_int---**Solution:**<jupyter_code>var_int = 8
var_float = 15.0

type(2+2), type(2*2.0), type(var_float/var_int)<jupyter_output><empty_output><jupyter_text>**Exercise 2:** Import an ascii file1. Import the dataset "20200901_20200930_Monterey.lev15.csv" and save it to a variable called *aeronet*.2. Print the column names3. Find a column that doesn't have only missing values (-999) and (challenge!) calculate the mean using the following syntax *variable\["column"\].mean()*---**Solution:**<jupyter_code>fname = "data/20200901_20200930_Monterey.lev15.csv"
aeronet = pd.read_csv(fname, sep=',\s*', engine='python')
aeronet.head()
aeronet["AOD_1640nm"].mean()<jupyter_output><empty_output><jupyter_text>---**Exercise 3:** Filtering dataUsing the dataset imported in the previous example (*aeronet*):    1. Create a mask that filters the "AOD_870nm" column to only include values that are above 0.2. Create a new variables, *day_of_year*, with the mask applied to aeronet\["Day_of_Year(Fraction)"\].3. Create a new variables, *aod_870*, with the mask applied to aeronet\["AOD_870nm"\].4. Compare the mean value of *aeronet\["AOD_870nm"\]* to *aod_870*.    ---**Solution**<jupyter_code>mask_aod = (aeronet["AOD_870nm"] > 0 )
day_of_year = aeronet["Day_of_Year(Fraction)"][mask_aod]
aod_870 = aeronet["AOD_870nm"][mask_aod]
aeronet["AOD_870nm"].mean(), aod_870.mean()<jupyter_output><empty_output><jupyter_text>---**Exercise 4:** Create a scatterplotUse the variables *aod_870* and *day_of_year* that you made in Exercise 3 to:1. Create a scatter plot showing the *day_of_year* (x-axis) and *aod_870* (y-axis)2. Add y-axis and x-axis labels using *.set_xlabel()* and *.set_ylabel()*3. Adjust the color and size of the scatterplot---**Solution**<jupyter_code>fig = plt.figure() 
ax = plt.subplot()
ax.scatter(day_of_year, aod_870, s=0.5)
ax.set_xlabel('Day of Year')
ax.set_ylabel('AOD')
plt.show()<jupyter_output><empty_output><jupyter_text>Session 2---**Exercise 1**: Importing netCDF files1. Open the file "MOP03JM-201811-L3V95.6.3_thinned.nc" using the netCDF4 library2. Print the variable names3. What are the dimensions?---**Solution:**<jupyter_code>fname = 'data/MOP03JM-201811-L3V95.6.3_thinned.nc' 
mop_file_id = Dataset(fname, 'r')
mop_file_id<jupyter_output><empty_output><jupyter_text>---**Exercise 2**: Plot 3-dimensional dataPlot *AOD_lat*, *AOD_lon*, and *AOD_500* (which we imported from the "JRR-AOD_v2r3_j01_..." netCDF file as:1. Check the dimensions for all variables using *.shape*.2. Do you need to generate a meshgrid with *np.meshgrid()*?3. Create a = contour plot---**Solution:**<jupyter_code>fname='data/JRR-AOD_v2r3_j01_s202009152044026_e202009152045271_c202009152113150_thinned.nc'
aod_file_id = Dataset(fname)

AOD_550 = aod_file_id.variables['AOD550'][:,:]
AOD_lat = aod_file_id.variables['Latitude'][:,:]
AOD_lon = aod_file_id.variables['Longitude'][:,:]
AOD_lat.shape, AOD_lon.shape
fig = plt.figure() 
ax = plt.subplot()
co_plot = ax.contourf(AOD_lon, AOD_lat, AOD_550)
fig.colorbar(co_plot, orientation='horizontal')
plt.show()<jupyter_output><empty_output><jupyter_text>---**Exercise 3** Adding maps to plotsUsing *AOD_lat*, *AOD_lon*, and *AOD_550* (which we imported from the "JRR-AOD_v2r3_j01_..." netCDF file):1. Create a *contourf* plot (same as Exercise 2)2. Add the coastlines to a standard Plate Caree plot using *projection=* option.---**Solution**:<jupyter_code>fig = plt.figure()
ax = plt.subplot(projection=ccrs.PlateCarree())

ax.contourf(AOD_lon, AOD_lat, AOD_550)

ax.coastlines('50m')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14783060535203948, 'fraction_numerical': 0.06157443491816056, 'mean_word_length': 6.182835820895522, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '107786', 'license': 'MIT', 'n_tokens_mistral': 1627, 'n_tokens_neox': 1466, 'n_words': 343, 'path': 'Solutions_to_Exercises.ipynb', 'repo_name': 'modern-tools-workshop/NCWCP-workshop-2021', 'size': '3849'}