diff --git a/CIM/CIM outputs.ipynb b/CIM/CIM outputs.ipynb new file mode 100755 index 0000000..2d64da5 --- /dev/null +++ b/CIM/CIM outputs.ipynb @@ -0,0 +1,105 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " Script prepared by Dr. Dasaraden Mauree \n", + " Contact: EPFL \n", + " dasaraden.mauree@epfl.ch / dasaraden.mauree@gmail.com \n", + " \n", + " Use this script to read Profils.csv from CIM, select \n", + " specific rows and create new file." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#importing necessary packages\n", + "\n", + "import pandas as pd\n", + "import numpy as np\n", + "import time\n", + "import math\n", + "import matplotlib.pyplot as plt\n", + "import matplotlib.dates as dates\n", + "%matplotlib inline \n", + "from datetime import datetime, timedelta\n", + "from IPython.core.interactiveshell import InteractiveShell\n", + "InteractiveShell.ast_node_interactivity = \"all\"\n", + "\n", + "#Opening file and saving in array\n", + "profils=pd.read_csv(\"confluence/v2/Profils_july.csv\", header=\"infer\", sep=\";\", names = [\"z\", \"u\", \"v\", \"pt\", \"tke\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Selecting data\n", + "cf=profils[profils['z']==7.5]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "#Computing horizontal wind speed and air temperature (°C)\n", + "cf['U (m s$^{-1}$)']=(cf['u']**(2)+cf['v']**(2))**(1/2)\n", + "cf['Air Temp. (°C)']=cf['pt']-273.15" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "cf=cf.drop(['u', 'v','pt', 'tke'], axis=1)\n", + "cf=cf.round(1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "#Printing output in txt file\n", + "cf.to_csv(r'cf_results_july.txt', header=None, sep=' ', mode='a')" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python [default]", + "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.5.2" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}