<jupyter_start><jupyter_text>Open .mat files* an excerpt from the excellent [earthpy.org](http://earthpy.org/04_work_with_different_data_formats.html) First we have to load function that works with Matlab files:<jupyter_code>from scipy.io import loadmat
import numpy as np
%matplotlib inline
import matplotlib.pylab as plt<jupyter_output><empty_output><jupyter_text>We are going to download [Polar science center Hydrographic Climatology (PHC)](http://psc.apl.washington.edu/nonwp_projects/PHC/Climatology.html) for January in Matlab format.<jupyter_code>!wget https://www.dropbox.com/s/0kuzvz03gw6d393/PHC_jan.mat<jupyter_output>--2018-04-11 10:36:03--  https://www.dropbox.com/s/0kuzvz03gw6d393/PHC_jan.mat
Resolving www.dropbox.com... 172.16.31.10, fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b:401
Connecting to www.dropbox.com|172.16.31.10|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://dl.dropboxusercontent.com/content_link/xL0V7RXBpdHgpUBM14pSECmQ26OKgJrDx5Gs2cfXbTglwBYYedktnslcM2SrFdJX/file [following]
--2018-04-11 10:36:05--  https://dl.dropboxusercontent.com/content_link/xL0V7RXBpdHgpUBM14pSECmQ26OKgJrDx5Gs2cfXbTglwBYYedktnslcM2SrFdJX/file
Resolving dl.dropboxusercontent.com... 172.16.31.10, fdf8:f53e:61e4::18:406
Connecting to dl.dropboxusercontent.com|172.16.31.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9329048 (8.9M) [application/octet-stream]
Saving to: ‘PHC_jan.mat.1’

PHC_jan.mat.1       100%[===================>]   8.90M  --.-KB/s    in 0.1s    

2018-04-11 10:36:06 (65.8 MB/s) - ‘PHC_jan.mat.1’ saved [9329048/9329048]<jupyter_text>Open file:<jupyter_code>all_variables = loadmat('PHC_jan.mat')<jupyter_output><empty_output><jupyter_text>We can look at the names of variables stored in the file:<jupyter_code>all_variables.keys()<jupyter_output><empty_output><jupyter_text>We need only *PTEMP1* (3d potential temperature).<jupyter_code>temp = np.array(all_variables['PTEMP1'])<jupyter_output><empty_output><jupyter_text>Check variable's shape:<jupyter_code>temp.shape<jupyter_output><empty_output><jupyter_text>Show surface level:<jupyter_code>plt.imshow(temp[0,:,:])
plt.colorbar();<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13975576662143827, 'fraction_numerical': 0.08955223880597014, 'mean_word_length': 6.76140350877193, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 29, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '412826', 'license': 'Unlicense', 'n_tokens_mistral': 1032, 'n_tokens_neox': 914, 'n_words': 132, 'path': 'Examples-basic/Read_mat_files.ipynb', 'repo_name': 'Jennie8594/OCPhelp', 'size': '2192'}