<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 <a name="top"></a>
<div style="width
Step1:  Let's Import Some Data through NOAA
Step2:  Turn list of urls into one large, combined (concatenated) dataset based on time
Step3:  Take a peak to ensure everything was read successfully and understand the dataset that you have
Step4:  Take another peak
Step5:  Write out data for processing
<ASSISTANT_TASK:>
Python Code:
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import netCDF4 as nc
from mpl_toolkits.basemap import Basemap
from datetime import datetime
from dask.diagnostics import ProgressBar
%matplotlib inline
from dask.distributed import Client
import xarray as xr
Explanation: <a name="top"></a>
<div style="width:1000 px">
<div style="float:right; width:98 px; height:98px;">
<img src="https://cdn.miami.edu/_assets-common/images/system/um-logo-gray-bg.png" alt="Miami Logo" style="height: 98px;">
</div>
<h1>Lunch Byte 4/19/2019</h1>
By Kayla Besong
<br>
<br>
<br>Introduction to Xarray and Dask to upload and process data from NOAA for ProcessData_XR.ipynb
<br>use to compare to GettingData_XR.ipynb
<div style="clear:both"></div>
</div>
<hr style="height:2px;">
End of explanation
%%time
heights = []                                   # empty array to append opened netCDF's to
temps = []
date_range = np.arange(1995,2001,1)            # range of years interested in obtaining, remember python starts counting at 0 so for 10 years we actually need to say through 2005
for i in date_range:
    url_h = 'https://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis2/pressure/hgt.%s.nc' % i    # string subset -->  %.s and % i will insert the i in date_range we are looping through
    url_t = 'https://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis2/pressure/air.%s.nc' % i
    print(url_h, url_t)
    
    heights.append(url_h)                                         # append 
    temps.append(url_t)
Explanation: Let's Import Some Data through NOAA
End of explanation
%%time 
concat_h = xr.open_mfdataset(heights)                          # aligns all the lat, lon, lev, values of all the datasets based on dimesnion of time
%%time 
concat_t = xr.open_mfdataset(temps)
Explanation: Turn list of urls into one large, combined (concatenated) dataset based on time
End of explanation
concat_h, concat_t
%%time
concat_h = concat_h.sel(lat = slice(90,0), level = 500).resample(time = '24H').mean(dim = 'time')
%%time
concat_t = concat_t.sel(lat = slice(90,0), level = 925).resample(time = '24H').mean(dim = 'time')
Explanation: Take a peak to ensure everything was read successfully and understand the dataset that you have
End of explanation
concat_h, concat_t
Explanation: Take another peak
End of explanation
%%time
concat_h.to_netcdf('heights_9520.nc')
%%time
concat_t.to_netcdf('temps_9520.nc')
Explanation: Write out data for processing
End of explanation
<END_TASK>