Vortex.ihrc.fiu.edu



Final review1. Numpy array (Lect04)>>> import numpy as np>>> myArray=np.array(mylist)>>> myArray=np.zeros((3,3))>>> myArray= np.arange(0,10,0.2)>>> myArray =np.linspace(2.0, 3.0, num=5)# NumPy Array Slicing>>> myArray[0:2,0:2]#Transposing an array,>>> np.transpose(myArray)>>> myarray.T#Finding dimensions of an array>>> myArray.shape# Reshaping an array,>>> myArray_1= myArray.reshape(2,6)#Find elements in an array satisfying a condition>>> myArray[myArray>5]#Array math>>> Z=X+Y>>> Z=X-Y>>> Z=X*Y>>> Z=X/Y>>>np.sin, np.cos, np.exp, np.sqrt, …2. numpy statistics (Lect05)#mean>>> np.mean(x)>>> np.mean(x,axis=0)>>> np.mean(x,axis=1)>>> np.nanmean(x)>>> np.nanmean(x,axis=0)>>> np.nanmean(x,axis=1)#minimum, maximum>>> np.amin(x)>>> np.amin(x,axis=0)>>> np.amin(x,axis=1)>>> np.nanmin(x)>>> np.nanmin(x,axis=0)>>> np.nanmin(x,axis=1)>>> np.amax(x)>>> np.amax(x,axis=0)>>> np.amax(x,axis=1)>>> np.nanmax(x)>>> np.nanmax(x,axis=0)>>> np.nanmax(x,axis=1)# Finding array index of minimum and maximum>>>i_min=np.argmin(a)>>>i_min=np.argmin(a,axis=0)>>>i_min=np.argmin(a,axis=1)>>>i_max=np.argmax(a)>>>i_max=np.argmax(a,axis=0)>>>i_max=np.argmax(a,axis=1)#standard deviation >>> np.std(x)>>> np.std(x,axis=0)>>> np.std(x,axis=1)>>> np.nanstd(x)>>> np.nanstd(x,axis=0)>>> np.nanstd(x,axis=1)3. Graphics >>>import matplotlib.pyplot as pltplt.plot; plt.title; plt.xlabel; plt.ylabel; plt.xticks; plt.yticks; plt.axis; plt.legend; plt.text; plt.figure; plt.subplot; plt.tight_layout; plt.savefig; plt.show…Examples: plt.plot_example1.py; plt.plot_example3.py; pyplot_exercise_1.py (Lect07) #errorbar plotExample: plt.plot_example2.py (Lect07)4. pyplot_statistics# Histogram plotExample: example1.py; example3.py (Lect08)#pie chartExample: example4.py (Lect08)5. 2D plots#contourExample: contour_example.py (Lect10)#contourfExample: contourf_example.py (Lect10)#quiverExample: quiver_example.py (Lect10)#3D plotsExample: surface_example.py (Lect10)6. Basemap (Lect13)>>> from mpl_toolkits.basemap import BasemapExample: basemap_example_1.py; basemap_example_2.py; basemap_example_3.py; basemap_example_4.py; basemap_example_5.py; basemap_example_6.py;7. def function (Lect15)Example: def_func_example.py, def_func_exercise_1.py8. IO (Lect06)#Read python, matlab, and netcdf format dataIO.docx (Lect06) 9. Python flow control (Lect02)Python_flow_control.docx#‘for’ and ‘while’ loopExamples: eg6_for.py; eg7_for.py; eg8_for.py; eg9_for.py; eg3_while_loop.py# ‘if’, ‘break’, and ‘continue’ statementExamples: eg1_if_statement.py, eg2_if_statement.py, eg4_break.py, eg5_continue.py ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download