<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 North Atlantic Winter Weather Regimes
Step1:  The data is from the Columbia University IRI data library
Step2:  Convert the data from the library into an xarray Dataset
Step3:  Get the DataArray and load it into memory
Step4:  Perform the k-means clustering
Step5:  Show the results
<ASSISTANT_TASK:>
Python Code:
import numpy as np
import matplotlib.pyplot as plt
import xarray as xr
# personal packages
from xlearn.cluster import KMeans
from pyingrid import Ingrid
import geoxarray
%matplotlib inline
Explanation: North Atlantic Winter Weather Regimes: K-means Clustering
Wenchang Yang (yang.wenchang@uci.edu)
Apply the k-means clustering on the NCEP/NCAR reanalysis 500hPa geopotential height (Z500) anomalies to get the North Atlantic winter weather regimes, including:
* NAO+ (positive NAO) 
* NAO- (negative NAO)
* Blocking 
* Atlantic Ridge.
End of explanation
ig = Ingrid('http://iridl.ldeo.columbia.edu',
            'SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.MONTHLY',
            '.Intrinsic/.PressureLevel/.phi')\
    .do('P(500)VALUES') \
    .do('T(Dec 1979)(Mar 2010)RANGE')\
    .do('yearly-anomalies') \
    .do('T(Dec)(Jan)(Feb)(Mar)VALUES')\
    .do('X -90 2 60 GRID Y 80 -2 20 GRID')
print(ig)
print('\n[Final data URL]:\n', ig.to_url())
Explanation: The data is from the Columbia University IRI data library
End of explanation
ds = ig.to_dataset()
print(ds)
Explanation: Convert the data from the library into an xarray Dataset
End of explanation
da = ds.sel(P=500).phi.load()
print(da.name, da.dims)
print(da.coords)
Explanation: Get the DataArray and load it into memory
End of explanation
m = KMeans(n_clusters=4, random_state=0, n_jobs=-1).fit(da)
print(m)
Explanation: Perform the k-means clustering
End of explanation
fig, axes = plt.subplots(2,2, figsize=(8,8))
regimes = ['NAO$^-$', 'NAO$^+$', 'Blocking', 'Atlantic Ridge']
tags = list('abcd')
for i in range(m.n_clusters):
    m.plot_cluster_centers(label=i, 
        proj='ortho', 
        plot_type='contourf+', 
        levels=np.arange(-110, 111, 20),
        units='m',
        ax=axes.flat[i])
    title = '{}, {}'.format(regimes[i],
                            axes.flat[i].title.get_text())
    plt.title(title)
    plt.text(0, 1, tags[i], 
             transform=axes.flat[i].transAxes, 
             va='bottom', 
             fontsize=plt.rcParams['font.size']*2, 
             fontweight='bold')
    
Explanation: Show the results
End of explanation
<END_TASK>