{ "cells": [ { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "import matplotlib as mpl\n", "from datetime import datetime, timedelta\n", "import pytz\n", "import xarray as xr\n", "import metpy as mpy\n", "from pandas.tseries.offsets import *\n", "from metpy import units " ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel\\__main__.py:24: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'.\n", "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel\\__main__.py:25: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'.\n", "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel\\__main__.py:26: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'.\n", "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel\\__main__.py:27: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'.\n", "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel\\__main__.py:28: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'.\n", "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel\\__main__.py:29: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'.\n", "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel\\__main__.py:34: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'.\n", "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel\\__main__.py:35: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'.\n", "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel\\__main__.py:36: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'.\n", "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel\\__main__.py:37: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'.\n", "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel\\__main__.py:38: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'.\n", "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel\\__main__.py:39: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'.\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
1234567891011121314151617
0
2017-08-14 19:30:0120.5338/14/17 7:30:01 PM20.1648/14/17 7:30:01 PM18.5898/14/17 7:30:01 PM19.5948/14/17 7:30:01 PM17.1608/14/17 7:30:01 PM16.5828/14/17 7:30:01 PM19.0788/14/17 7:30:01 PM16.5948/14/17 7:30:01 PM19.101
2017-08-14 20:00:0120.5338/14/17 8:00:01 PM20.1648/14/17 8:00:01 PM18.5898/14/17 8:00:01 PM19.5948/14/17 8:00:01 PM17.6618/14/17 8:00:01 PM16.0818/14/17 8:00:01 PM19.0788/14/17 8:00:01 PM16.5948/14/17 8:00:01 PM18.601
2017-08-14 20:30:0121.0348/14/17 8:30:01 PM20.1648/14/17 8:30:01 PM18.5898/14/17 8:30:01 PM19.5948/14/17 8:30:01 PM17.1608/14/17 8:30:01 PM16.0818/14/17 8:30:01 PM19.0788/14/17 8:30:01 PM16.5948/14/17 8:30:01 PM19.601
2017-08-14 21:00:0120.0338/14/17 9:00:01 PM19.6638/14/17 9:00:01 PM18.5898/14/17 9:00:01 PM19.5948/14/17 9:00:01 PM17.1608/14/17 9:00:01 PM15.5808/14/17 9:00:01 PM19.0788/14/17 9:00:01 PM16.5948/14/17 9:00:01 PM19.101
2017-08-14 21:30:0120.0338/14/17 9:30:01 PM19.6638/14/17 9:30:01 PM18.5898/14/17 9:30:01 PM19.0948/14/17 9:30:01 PM17.1608/14/17 9:30:01 PM15.0798/14/17 9:30:01 PM18.5778/14/17 9:30:01 PM16.0938/14/17 9:30:01 PM19.101
\n", "
" ], "text/plain": [ " 1 2 3 4 \\\n", "0 \n", "2017-08-14 19:30:01 20.533 8/14/17 7:30:01 PM 20.164 8/14/17 7:30:01 PM \n", "2017-08-14 20:00:01 20.533 8/14/17 8:00:01 PM 20.164 8/14/17 8:00:01 PM \n", "2017-08-14 20:30:01 21.034 8/14/17 8:30:01 PM 20.164 8/14/17 8:30:01 PM \n", "2017-08-14 21:00:01 20.033 8/14/17 9:00:01 PM 19.663 8/14/17 9:00:01 PM \n", "2017-08-14 21:30:01 20.033 8/14/17 9:30:01 PM 19.663 8/14/17 9:30:01 PM \n", "\n", " 5 6 7 8 \\\n", "0 \n", "2017-08-14 19:30:01 18.589 8/14/17 7:30:01 PM 19.594 8/14/17 7:30:01 PM \n", "2017-08-14 20:00:01 18.589 8/14/17 8:00:01 PM 19.594 8/14/17 8:00:01 PM \n", "2017-08-14 20:30:01 18.589 8/14/17 8:30:01 PM 19.594 8/14/17 8:30:01 PM \n", "2017-08-14 21:00:01 18.589 8/14/17 9:00:01 PM 19.594 8/14/17 9:00:01 PM \n", "2017-08-14 21:30:01 18.589 8/14/17 9:30:01 PM 19.094 8/14/17 9:30:01 PM \n", "\n", " 9 10 11 12 \\\n", "0 \n", "2017-08-14 19:30:01 17.160 8/14/17 7:30:01 PM 16.582 8/14/17 7:30:01 PM \n", "2017-08-14 20:00:01 17.661 8/14/17 8:00:01 PM 16.081 8/14/17 8:00:01 PM \n", "2017-08-14 20:30:01 17.160 8/14/17 8:30:01 PM 16.081 8/14/17 8:30:01 PM \n", "2017-08-14 21:00:01 17.160 8/14/17 9:00:01 PM 15.580 8/14/17 9:00:01 PM \n", "2017-08-14 21:30:01 17.160 8/14/17 9:30:01 PM 15.079 8/14/17 9:30:01 PM \n", "\n", " 13 14 15 16 \\\n", "0 \n", "2017-08-14 19:30:01 19.078 8/14/17 7:30:01 PM 16.594 8/14/17 7:30:01 PM \n", "2017-08-14 20:00:01 19.078 8/14/17 8:00:01 PM 16.594 8/14/17 8:00:01 PM \n", "2017-08-14 20:30:01 19.078 8/14/17 8:30:01 PM 16.594 8/14/17 8:30:01 PM \n", "2017-08-14 21:00:01 19.078 8/14/17 9:00:01 PM 16.594 8/14/17 9:00:01 PM \n", "2017-08-14 21:30:01 18.577 8/14/17 9:30:01 PM 16.093 8/14/17 9:30:01 PM \n", "\n", " 17 \n", "0 \n", "2017-08-14 19:30:01 19.101 \n", "2017-08-14 20:00:01 18.601 \n", "2017-08-14 20:30:01 19.601 \n", "2017-08-14 21:00:01 19.101 \n", "2017-08-14 21:30:01 19.101 " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "file1_temp = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc1_temp.csv'\n", "file2_temp = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc2_temp.csv'\n", "file4_temp = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc4_temp.csv'\n", "file5_temp = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc5_temp.csv'\n", "file6_temp = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc6_temp.csv'\n", "file7_temp = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc7_temp.csv'\n", "file8_temp = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc8_temp.csv'\n", "file9_temp = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc9_temp.csv'\n", "file10_temp = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc10_temp.csv'\n", "\n", "file1_rh = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc1_rh.csv'\n", "file2_rh = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc2_rh.csv'\n", "file4_rh = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc4_rh.csv'\n", "file5_rh = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc5_rh.csv'\n", "file6_rh = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc6_rh.csv'\n", "file7_rh = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc7_rh.csv'\n", "file8_rh = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc8_rh.csv'\n", "file9_rh = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc9_rh.csv'\n", "file10_rh = 'C:/Users/Matthew/Documents/summerintership/ibutton/ibutton_loc10_rh.csv'\n", "\n", "loc1_temp = pd.read_csv(file1_temp, skiprows = 30, usecols = [0,2])\n", "loc2_temp = pd.read_csv(file2_temp, skiprows = 30, usecols = [0,2])\n", "loc4_temp = pd.read_csv(file4_temp, skiprows = 30, usecols = [0,2])\n", "loc5_temp = pd.read_csv(file5_temp, skiprows = 30, usecols = [0,2], skipfooter = 5)\n", "loc6_temp = pd.read_csv(file6_temp, skiprows = 30, usecols = [0,2], skipfooter = 5)\n", "loc7_temp = pd.read_csv(file7_temp, skiprows = 30, usecols = [0,2], skipfooter = 5)\n", "loc8_temp = pd.read_csv(file8_temp, skiprows = 30, usecols = [0,2], skipfooter = 4)\n", "loc9_temp = pd.read_csv(file9_temp, skiprows = 30, usecols = [0,2], skipfooter = 4)\n", "loc10_temp = pd.read_csv(file10_temp, skiprows = 30, usecols = [0,2], skipfooter = 4)\n", "\n", "loc1_rh = pd.read_csv(file1_rh, skiprows = 30, usecols = [0,2])\n", "loc2_rh = pd.read_csv(file2_rh, skiprows = 30, usecols = [0,2])\n", "loc4_rh = pd.read_csv(file4_rh, skiprows = 30, usecols = [0,2])\n", "loc5_rh = pd.read_csv(file5_rh, skiprows = 30, usecols =[0,2], skipfooter = 5)\n", "loc6_rh = pd.read_csv(file6_rh, skiprows = 30, usecols = [0,2], skipfooter = 5)\n", "loc7_rh = pd.read_csv(file7_rh, skiprows = 30, usecols = [0,2], skipfooter = 5)\n", "loc8_rh = pd.read_csv(file8_rh, skiprows = 30, usecols = [0,2], skipfooter = 4)\n", "loc9_rh = pd.read_csv(file9_rh, skiprows = 30, usecols = [0,2], skipfooter = 4)\n", "loc10_rh = pd.read_csv(file10_rh, skiprows = 30, usecols = [0,2], skipfooter = 4)\n", "\n", "df_temp = pd.concat([loc1_temp, loc2_temp, loc4_temp, loc5_temp, loc6_temp, loc7_temp, loc8_temp, loc9_temp, loc10_temp], axis=1, ignore_index=True)\n", "\n", "\n", "df_rh = pd.concat([loc1_rh, loc2_rh, loc4_rh, loc5_rh, loc6_rh, loc7_rh, loc8_rh, loc9_rh, loc10_rh], axis=1, ignore_index=True)\n", "\n", "\n", "df_time_temp = pd.DatetimeIndex(df_temp[0])\n", "df_temp.index = pd.to_datetime(df_time_temp)\n", "\n", "\n", "\n", "df_time_rh = pd.DatetimeIndex(df_rh[0])\n", "df_rh.index = pd.to_datetime(df_time_rh)\n", "\n", "\n", "df_temp = df_temp.drop(0, axis=1)\n", "df_rh = df_rh.drop(0, axis=1)\n", "\n", "df_temp.head()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "0\n", "2017-08-14 19:30:01 20.533\n", "2017-08-14 20:00:01 20.533\n", "2017-08-14 20:30:01 21.034\n", "2017-08-14 21:00:01 20.033\n", "2017-08-14 21:30:01 20.033\n", "2017-08-14 22:00:01 20.033\n", "2017-08-14 22:30:01 19.031\n", "2017-08-14 23:00:01 18.531\n", "2017-08-14 23:30:01 18.030\n", "2017-08-15 00:00:01 16.528\n", "2017-08-15 00:30:01 16.027\n", "2017-08-15 01:00:01 16.528\n", "2017-08-15 01:30:01 16.528\n", "2017-08-15 02:00:01 18.030\n", "2017-08-15 02:30:01 18.030\n", "2017-08-15 03:00:01 18.030\n", "2017-08-15 03:30:01 17.529\n", "2017-08-15 04:00:01 16.027\n", "2017-08-15 04:30:01 17.029\n", "2017-08-15 05:00:01 18.531\n", "2017-08-15 05:30:01 18.531\n", "2017-08-15 06:00:01 18.531\n", "2017-08-15 06:30:01 18.030\n", "2017-08-15 07:00:01 18.531\n", "2017-08-15 07:30:01 18.030\n", "2017-08-15 08:00:01 18.030\n", "2017-08-15 08:30:01 18.030\n", "2017-08-15 09:00:01 18.030\n", "2017-08-15 09:30:01 17.029\n", "2017-08-15 10:00:01 16.027\n", " ... \n", "2017-08-24 23:30:01 12.018\n", "2017-08-25 00:00:01 12.018\n", "2017-08-25 00:30:01 11.517\n", "2017-08-25 01:00:01 11.015\n", "2017-08-25 01:30:01 10.514\n", "2017-08-25 02:00:01 10.514\n", "2017-08-25 02:30:01 10.514\n", "2017-08-25 03:00:01 10.012\n", "2017-08-25 03:30:01 9.511\n", "2017-08-25 04:00:01 9.009\n", "2017-08-25 04:30:01 9.009\n", "2017-08-25 05:00:01 9.511\n", "2017-08-25 05:30:01 9.009\n", "2017-08-25 06:00:01 9.009\n", "2017-08-25 06:30:01 9.009\n", "2017-08-25 07:00:01 9.511\n", "2017-08-25 07:30:01 8.508\n", "2017-08-25 08:00:01 8.006\n", "2017-08-25 08:30:01 7.504\n", "2017-08-25 09:00:01 7.504\n", "2017-08-25 09:30:01 7.504\n", "2017-08-25 10:00:01 8.006\n", "2017-08-25 10:30:01 8.006\n", "2017-08-25 11:00:01 8.006\n", "2017-08-25 11:30:01 8.508\n", "2017-08-25 12:00:01 9.009\n", "2017-08-25 12:30:01 9.511\n", "2017-08-25 13:00:01 10.012\n", "2017-08-25 13:30:01 11.015\n", "2017-08-25 14:00:01 11.015\n", "Name: 1, Length: 518, dtype: float64" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "time = np.array(df_temp.index)\n", "df_temp[1]" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [], "source": [ "time = xr.DataArray(time, name= ['time'])" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [], "source": [ "temp1 = xr.DataArray(df_temp[1], name= ['Location 1 Temp'], coords=[time], dims=['time'])\n", "temp2 = xr.DataArray(df_temp[3], name= ['Location 2 Temp'], coords=[time], dims=['time'])\n", "temp4 = xr.DataArray(df_temp[5], name= ['Location 4 Temp'], coords=[time], dims=['time'])\n", "temp5 = xr.DataArray(df_temp[7], name= ['Location 5 Temp'], coords=[time], dims=['time'])\n", "temp6 = xr.DataArray(df_temp[9], name= ['Location 6 Temp'], coords=[time], dims=['time'])\n", "temp7 = xr.DataArray(df_temp[11], name= ['Location 7 Temp'], coords=[time], dims=['time'])\n", "temp8 = xr.DataArray(df_temp[13], name= ['Location 8 Temp'], coords=[time], dims=['time'])\n", "temp9 = xr.DataArray(df_temp[15], name= ['Location 9 Temp'], coords=[time], dims=['time'])\n", "temp10 = xr.DataArray(df_temp[17], name= ['Location 10 Temp'], coords=[time], dims=['time'])\n", "\n", "rh1 = xr.DataArray(df_rh[1], name= ['Location 1 rh'], coords=[time], dims=['time'])\n", "rh2 = xr.DataArray(df_rh[3], name= ['Location 2 rh'], coords=[time], dims=['time'])\n", "rh4= xr.DataArray(df_rh[5], name= ['Location 4 rh'], coords=[time], dims=['time'])\n", "rh5 = xr.DataArray(df_rh[7], name= ['Location 5 rh'], coords=[time], dims=['time'])\n", "rh6 = xr.DataArray(df_rh[9], name= ['Location 6 rh'], coords=[time], dims=['time'])\n", "rh7 = xr.DataArray(df_rh[11], name= ['Location 7 rh'], coords=[time], dims=['time'])\n", "rh8 = xr.DataArray(df_rh[13], name= ['Location 8 rh'], coords=[time], dims=['time'])\n", "rh9 = xr.DataArray(df_rh[15], name= ['Location 9 rh'], coords=[time], dims=['time'])\n", "rh10 = xr.DataArray(df_rh[17], name= ['Location 10 rh'], coords=[time], dims=['time'])" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [], "source": [ "temp1.attrs['units'] = 'degC'\n", "temp2.attrs['units'] = 'degC'\n", "temp4.attrs['units'] = 'degC'\n", "temp5.attrs['units'] = 'degC'\n", "temp6.attrs['units'] = 'degC'\n", "temp7.attrs['units'] = 'degC'\n", "temp8.attrs['units'] = 'degC'\n", "temp9.attrs['units'] = 'degC'\n", "temp10.attrs['units'] = 'degC'\n", "\n", "temp1.attrs['lat'] = \"44° 24.042'\"\n", "temp2.attrs['lat'] = \"44° 23.907'\"\n", "temp4.attrs['lat'] = \"44° 23.363'\"\n", "temp5.attrs['lat'] = \"44° 22.910'\"\n", "temp6.attrs['lat'] = \"44° 22.510'\"\n", "temp7.attrs['lat'] = \"44° 22.277'\"\n", "temp8.attrs['lat'] = \"44° 22.160'\"\n", "temp9.attrs['lat'] = \"44° 22.170'\"\n", "temp10.attrs['lat'] = \"44° 22.052'\"\n", "\n", "temp1.attrs['lon'] = \"73° 53.640'\"\n", "temp2.attrs['lon'] = \"73° 53.787'\"\n", "temp4.attrs['lon'] = \"73° 53.925'\"\n", "temp5.attrs['lon'] = \"73° 54.242'\"\n", "temp6.attrs['lon'] = \"73° 54.119'\"\n", "temp7.attrs['lon'] = \"73° 53.367'\"\n", "temp8.attrs['lon'] = \"73° 54.745'\"\n", "temp9.attrs['lon'] = \"73° 53.920'\"\n", "temp10.attrs['lon'] = \"73° 54.257'\"\n", "\n", "temp1.attrs['elevation(m)'] = '793'\n", "temp2.attrs['elevation(m)'] = '858'\n", "temp4.attrs['elevation(m)'] = '973'\n", "temp5.attrs['elevation(m)'] = '1068'\n", "temp6.attrs['elevation(m)'] = '1148'\n", "temp7.attrs['elevation(m)'] = '1198'\n", "temp8.attrs['elevation(m)'] = '1250'\n", "temp9.attrs['elevation(m)'] = '1351'\n", "temp10.attrs['elevation(m)'] = '1396'\n", "\n", "rh1.attrs['units'] = 'degC'\n", "rh2.attrs['units'] = 'degC'\n", "rh4.attrs['units'] = 'degC'\n", "rh5.attrs['units'] = 'degC'\n", "rh6.attrs['units'] = 'degC'\n", "rh7.attrs['units'] = 'degC'\n", "rh8.attrs['units'] = 'degC'\n", "rh9.attrs['units'] = 'degC'\n", "rh10.attrs['units'] = 'degC'\n", "\n", "rh1.attrs['lat'] = \"44° 24.042'\"\n", "rh2.attrs['lat'] = \"44° 23.907'\"\n", "rh4.attrs['lat'] = \"44° 23.363'\"\n", "rh5.attrs['lat'] = \"44° 22.910'\"\n", "rh6.attrs['lat'] = \"44° 22.510'\"\n", "rh7.attrs['lat'] = \"44° 22.277'\"\n", "rh8.attrs['lat'] = \"44° 22.160'\"\n", "rh9.attrs['lat'] = \"44° 22.170'\"\n", "rh10.attrs['lat'] = \"44° 22.052'\"\n", "\n", "rh1.attrs['lon'] = \"73° 53.640'\"\n", "rh2.attrs['lon'] = \"73° 53.787'\"\n", "rh4.attrs['lon'] = \"73° 53.925'\"\n", "rh5.attrs['lon'] = \"73° 54.242'\"\n", "rh6.attrs['lon'] = \"73° 54.119'\"\n", "rh7.attrs['lon'] = \"73° 53.367'\"\n", "rh8.attrs['lon'] = \"73° 54.745'\"\n", "rh9.attrs['lon'] = \"73° 53.920'\"\n", "rh10.attrs['lon'] = \"73° 54.257'\"\n", "\n", "rh1.attrs['elevation(m)'] = '793'\n", "rh2.attrs['elevation(m)'] = '858'\n", "rh4.attrs['elevation(m)'] = '973'\n", "rh5.attrs['elevation(m)'] = '1068'\n", "rh6.attrs['elevation(m)'] = '1148'\n", "rh7.attrs['elevation(m)'] = '1198'\n", "rh8.attrs['elevation(m)'] = '1250'\n", "rh9.attrs['elevation(m)'] = '1351'\n", "rh10.attrs['elevation(m)'] = '1396'\n" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [], "source": [ "ds = temp1.to_dataset(name = 'temp1')\n", "ds['temp2'] = temp2\n", "ds['temp4'] = temp4\n", "ds['temp5'] = temp5\n", "ds['temp6'] = temp6\n", "ds['temp7'] = temp7\n", "ds['temp8'] = temp8\n", "ds['temp9'] = temp9\n", "ds['temp10'] = temp10\n", "\n", "ds['rh1'] = rh1\n", "ds['rh2'] = rh2\n", "ds['rh4'] = rh4\n", "ds['rh5'] = rh5\n", "ds['rh6'] = rh6\n", "ds['rh7'] = rh7\n", "ds['rh8'] = rh8\n", "ds['rh9'] = rh9\n", "ds['rh10'] = rh10" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "\n", "Dimensions: (time: 518)\n", "Coordinates:\n", " * time (time) datetime64[ns] 2017-08-14T19:30:01 2017-08-14T20:00:01 ...\n", "Data variables:\n", " temp1 (time) float64 20.53 20.53 21.03 20.03 20.03 20.03 19.03 18.53 ...\n", " temp2 (time) float64 20.16 20.16 20.16 19.66 19.66 19.16 19.16 18.66 ...\n", " temp4 (time) float64 18.59 18.59 18.59 18.59 18.59 18.59 18.09 17.59 ...\n", " temp5 (time) float64 19.59 19.59 19.59 19.59 19.09 19.09 18.09 18.09 ...\n", " temp6 (time) float64 17.16 17.66 17.16 17.16 17.16 16.66 16.66 16.66 ...\n", " temp7 (time) float64 16.58 16.08 16.08 15.58 15.08 14.58 14.58 14.08 ...\n", " temp8 (time) float64 19.08 19.08 19.08 19.08 18.58 18.08 17.58 17.07 ...\n", " temp9 (time) float64 16.59 16.59 16.59 16.59 16.09 15.09 14.59 14.09 ...\n", " temp10 (time) float64 19.1 18.6 19.6 19.1 19.1 18.1 19.1 17.6 16.1 ...\n", " rh1 (time) float64 55.52 56.73 52.45 64.49 62.73 60.95 66.25 69.71 ...\n", " rh2 (time) float64 57.75 64.34 58.36 61.37 63.75 57.14 59.57 60.17 ...\n", " rh4 (time) float64 61.93 61.93 62.52 58.39 63.68 57.79 65.42 66.0 ...\n", " rh5 (time) float64 58.95 56.49 57.72 54.62 58.34 52.11 58.95 60.78 ...\n", " rh6 (time) float64 68.11 62.37 67.47 67.47 70.02 68.75 67.47 70.02 ...\n", " rh7 (time) float64 72.6 68.67 73.15 74.8 76.44 76.99 74.25 74.25 ...\n", " rh8 (time) float64 64.43 60.91 62.68 62.68 59.12 63.85 64.43 67.33 ...\n", " rh9 (time) float64 67.17 65.43 67.74 65.43 65.43 67.17 72.85 75.08 ...\n", " rh10 (time) float64 59.13 60.32 57.94 57.34 57.94 57.94 56.13 59.13 ...\n", "Attributes:\n", " Title: iButton Temperature and Humidity\n", " Location: Whiteface Mountain Memorial Highway" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.attrs['Title'] = 'iButton Temperature and Humidity'\n", "ds.attrs['Location'] = 'Whiteface Mountain Memorial Highway'\n", "ds" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": true }, "outputs": [], "source": [ "ds.to_netcdf('C:/Users/Matthew/Documents/summerintership/ibutton.nc')" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "\n", "array([ 55.517, 56.734, 52.447, ..., 89.843, 87.247, 88.29 ])\n", "Coordinates:\n", " * time (time) datetime64[ns] 2017-08-14T19:30:01 2017-08-14T20:00:01 ...\n", "Attributes:\n", " units: degC\n", " lat: 44° 24.042'\n", " lon: 73° 53.640'\n", " elevation(m): 793" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds.rh1" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.0" } }, "nbformat": 4, "nbformat_minor": 2 }