logo

PCA definition of the SNAO

14 Pages2008 Words24 Views
   

Added on  2022-08-23

PCA definition of the SNAO

   Added on 2022-08-23

ShareRelated Documents
1. Exercise: PCA definition of the SNAO
1.1. Mean field
What is the size of the array dimensions, and what variables do the dimensions
stand for?
Ans - The size of the array dimensions is (6882, 19, 49), and the dimensions stand
for times, latitude, and longitude Variables, respectively.
Reading file function signature:
# open the NetCDF file
def read_slp_file():
...
nc.close ()
return np.array(a_p)
OUPUTS:
Numpy Arry Dimensions: (6882, 19, 49)
Nupy Array From Data: [[[1019.81811523 1020.60813904
1021.24891281 ... 1005.73635101
1004.37040329 1002.0316124 ]
[1020.88832855 1021.62733078 1022.23796844 ... 1004.93898392
1003.11946869 1001.22900009]
[1020.79801559 1021.65632248 1022.42031097 ... 1003.34892273
1001.53303146 1002.16884613]
...
Mean: [[1018.26716958 1018.68608335 1019.05067813 1019.41502566
1019.71260015
PCA  definition  of the SNAO_1
1019.98284504 1020.25390332 1020.4601797 1020.63480082
1020.76555615
1020.82791205 1020.83084472 1020.75385275 1020.61127326
1020.40297819
1020.06660871 1019.65630111 1019.1413789 1018.39625052
1017.57660415
1016.61588081 1015.33878966 1013.80889227 1012.21986655
1010.31300429
1009.31567616 1008.70009823 1008.31189279 1007.99127918
1008.35668427
1011.15001264 1012.96408787 1013.1500409 1013.07415332
1012.68953597
1012.56805851 1012.38244491 1011.62923332 1011.23315464
1010.24764474
1008.54080774 1006.94833841 1004.98581954 1004.29290973
1004.75389303
1003.96054274 1002.91209774 1001.04185097 998.73729931]
...
Calculate the climatological-mean pressure field and make a contour plot of this
fi
eld over a map of the North Atlantic/Europe
Ans: The mean is created using the numpy function numpy.mean as
np_array.mean(axis = 0)) where np_array refers to the python array created from
the data file. The output is matrix containing the climatological mean pressure.
This is achieved as shown below:
print('Mean:',np_array.mean(axis = 0))
OUTPUT:
1.2 Data matrix and covariance matrix (11 points)
PCA  definition  of the SNAO_2
First, create the data matrix X from the array you loaded in section 1.1. What
dimensions does it have, and what are the rows and columns?
Ans : (19, 49)
Now calculate the covariance matrix S from X. What are the dimensions and
properties of S?
Ans : (49, 49)
Remember that the pressure data are given on a regular latitude-longitude grid.
Have you scaled X (and S) accordingly? How?
Ans: Yes, X has been scaled to (19,49) because the masked array has dimensions
that are not standardized to fit a matrix. 19 and 49 are the columns with the leading
principal components
SAMPLE OUTPUTS:
MATRIX X: [[1019.81811523 1020.60813904 1021.24891281 1021.9119072
1022.49803543
1023.03667068 1023.61087799 1023.95477295 1024.1765976 1024.30810928
1024.32098389 1024.239254 1024.02038574 1023.69165421 1023.22092056
1022.49507904 1021.69799805 1020.83911896 1019.86560822 1018.97754669
1017.96979904 1016.60766602 1014.77432251 1012.62464523 1010.20488739
1009.69514847 1009.74025726 1009.43660736 1009.1050148 1010.04171371
1013.5723114 1015.42243958 1015.12432098 1014.57424164 1014.07470703
1013.93251419 1013.62371445 1012.77589798 1012.22543716 1010.89067459
1008.7843895 1007.1103096 1005.81998825 1005.89160919 1006.44760132
1005.96513748 1005.73635101 1004.37040329 1002.0316124 ]
[1020.88832855 1021.62733078 1022.23796844 1022.83210754 1023.34766388
1023.94580841 1024.6544838 1025.11577606 1025.37107468 1025.62303543
1025.8102417 1025.84848404 1025.5947113 1025.23603439 1024.73773956
PCA  definition  of the SNAO_3
1023.96755219 1023.17285538 1022.30873108 1021.31414413 1020.44000626
1019.47116852 1018.17531586 1016.73622131 1015.00444412 1012.53490448
1011.76338196 1011.90595627 1011.33794785 1010.68019867 1011.51676178
1013.23661804 1013.92946243 1014.31293488 1014.51454163 1014.85424042
1014.95380402 1013.99726868 1013.24262619 1012.57801056 1011.29608154
1009.6118927 1007.90805817 1006.30807877 1006.91184998 1007.05871582
1006.29167557 1004.93898392 1003.11946869 1001.22900009]
[1020.79801559 1021.65632248 1022.42031097 1023.02980423 1023.52075577
1024.16400909 1024.95737076 1025.59089661 1025.98438263 1026.24816895
1026.44195557 1026.41820908 1026.16033554 1026.01251602 1025.74911118
1025.10519028 1024.33252335 1023.46754074 1022.50785828 1021.66872025
1020.75939178 1019.56691742 1018.09396744 1016.20445251 1014.47944641
1015.20900726 1014.89620209 1013.57192993 1013.16108704 1013.69876862
1014.22967911 1014.84546661 1015.9040451 1016.69845581 1016.39308929
1015.8203125 1014.62430954 1013.69972229 1013.09013367 1011.90767288
1010.54754257 1009.58480835 1008.94422531 1007.9916954 1006.98156357
1005.27515411 1003.34892273 1001.53303146 1002.16884613]
[1019.00730133 1019.96669769 1021.13180161 1022.11780548 1022.82171249
1023.56548309 1024.47395325 1025.3279686 1026.0931015 1026.61590576
1026.79309845 1026.5838623 1026.39045715 1026.35154724 1026.22117996
1025.70886612 1024.98474121 1024.15218353 1023.29235077 1022.5733757
1021.81148529 1020.8741188 1019.73114014 1018.08643341 1016.14961624
1016.47052765 1018.22290421 1017.04111099 1016.11661911 1016.02888107
1015.87543488 1016.42169952 1017.91810989 1018.69764328 1017.6115036
PCA  definition  of the SNAO_4

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Importing and Presenting Data in MATLAB
|6
|1081
|215