{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "through-treasurer", "metadata": {}, "outputs": [], "source": [ "import xarray as xr\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import os\n", "from datetime import datetime, timedelta\n" ] }, { "cell_type": "markdown", "id": "promising-preparation", "metadata": {}, "source": [ "I want to plot the simulated winds for WLEF ( at 30 and 100m) with the measured winds. Both 1 minute and 30 minute averaged." ] }, { "cell_type": "markdown", "id": "prospective-joining", "metadata": {}, "source": [ "For WLEF I don't have to go through Brian's processed data. Can pull them in from the server. " ] }, { "cell_type": "code", "execution_count": 2, "id": "photographic-tonight", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'/mnt/c/Users/Sreenath/Documents/palm/Cheyenne/realistic_IOP03'" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pwd()" ] }, { "cell_type": "code", "execution_count": 17, "id": "empirical-aircraft", "metadata": {}, "outputs": [], "source": [ "tower_data = xr.open_dataset('tower_data/tower_and_meta_data.nc')\n", "tower_data.close()\n", "\n", "#subset for 2019 Sep 24 and Sep25\n", "f1 = tower_data.time>=267\n", "f2 = tower_data.time<=269" ] }, { "cell_type": "code", "execution_count": 18, "id": "intensive-marshall", "metadata": {}, "outputs": [], "source": [ "#calculate time variable and offset for UTC\n", "tower_data['time'] = (tower_data.DOY+tower_data.hour/24+tower_data.minute/60/24 - 5/24)\n", "tower_data = tower_data.set_coords(['time'])\n" ] }, { "cell_type": "code", "execution_count": 19, "id": "devoted-invention", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset>\n", "Dimensions: (timestep: 5616, tower: 17)\n", "Coordinates:\n", " * timestep (timestep) float32 0.0 1.0 2.0 ... 5.613e+03 5.614e+03 5.615e+03\n", " * tower (tower) |S3 b'nw1' b'nw2' b'nw3' b'nw4' ... b'se4' b'se5' b'se6'\n", " time (timestep) float64 170.8 170.8 170.8 170.9 ... 287.7 287.7 287.8\n", "Data variables:\n", " cov_wT (timestep, tower) float32 nan nan -0.0267 nan ... nan nan nan nan\n", " cov_wH2O (timestep, tower) float32 nan nan 0.03993 nan ... nan nan nan nan\n", " cov_wCO2 (timestep, tower) float32 nan nan 1.119 nan ... nan nan nan nan\n", " f_Hs (timestep, tower) float32 nan nan -30.16 nan ... nan nan nan nan\n", " f_Hl (timestep, tower) float32 nan nan 68.47 nan ... nan nan nan nan\n", " f_CO2 (timestep, tower) float32 nan nan 1.119 nan ... nan nan nan nan\n", " ustar (timestep, tower) float32 nan nan 0.1886 0.3965 ... nan nan nan\n", " wstar (timestep, tower) float32 9.969e+36 9.969e+36 ... 9.969e+36\n", " R_net (timestep, tower) float32 nan nan nan 59.42 ... nan nan nan nan\n", " ghf (timestep, tower) float32 8.721 nan 11.6 12.22 ... -0.0 -0.0 -0.0\n", " S_store (timestep, tower) float32 nan nan nan nan 0.0 ... 0.0 0.0 0.0 0.0\n", " T_store (timestep, tower) float32 nan nan -0.4062 nan ... nan nan nan nan\n", " Q_store (timestep, tower) float32 nan nan 0.04815 nan ... nan nan nan nan\n", " u (timestep, tower) float32 nan nan -0.4987 -2.516 ... nan nan nan\n", " v (timestep, tower) float32 nan nan -1.604 -1.946 ... nan nan nan\n", " w (timestep, tower) float32 nan nan -0.1089 0.6126 ... nan nan nan\n", " T (timestep, tower) float32 nan nan 293.8 294.1 ... nan nan nan nan\n", " q (timestep, tower) float32 nan nan 10.11 nan ... nan nan nan nan\n", " year (timestep) float32 2.019e+03 2.019e+03 ... 2.019e+03 2.019e+03\n", " month (timestep) float32 6.0 6.0 6.0 6.0 6.0 ... 10.0 10.0 10.0 10.0\n", " day (timestep) float32 20.0 20.0 20.0 20.0 ... 14.0 14.0 14.0 14.0\n", " DOY (timestep) int32 171 171 171 171 171 171 ... 287 287 287 287 287\n", " hour (timestep) float32 0.0 0.0 1.0 1.0 2.0 ... 22.0 22.0 23.0 23.0\n", " minute (timestep) float32 0.0 30.0 0.0 30.0 0.0 ... 0.0 30.0 0.0 30.0\n", " z_meas (tower) float32 32.0 12.0 3.0 32.0 32.0 ... 32.0 3.0 12.0 32.0
array([0.000e+00, 1.000e+00, 2.000e+00, ..., 5.613e+03, 5.614e+03, 5.615e+03],\n", " dtype=float32)
array([b'nw1', b'nw2', b'nw3', b'nw4', b'ne1', b'ne2', b'ne3', b'ne4', b'sw1',\n", " b'sw2', b'sw3', b'sw4', b'se2', b'se3', b'se4', b'se5', b'se6'],\n", " dtype='|S3')
array([170.79166667, 170.8125 , 170.83333333, ..., 287.72916669,\n", " 287.74999998, 287.77083331])
array([[ nan, nan, -0.026703, ..., nan, nan, nan],\n", " [ nan, nan, -0.025013, ..., nan, nan, nan],\n", " [ nan, nan, -0.031405, ..., nan, nan, nan],\n", " ...,\n", " [ nan, nan, -0.016991, ..., nan, nan, nan],\n", " [ nan, nan, -0.053063, ..., nan, nan, nan],\n", " [ nan, nan, nan, ..., nan, nan, nan]],\n", " dtype=float32)
array([[ nan, nan, 0.039932, ..., nan, nan, nan],\n", " [ nan, nan, 0.034378, ..., nan, nan, nan],\n", " [ nan, nan, 0.038521, ..., nan, nan, nan],\n", " ...,\n", " [ nan, nan, 0.00862 , ..., nan, nan, nan],\n", " [ nan, nan, 0.018269, ..., nan, nan, nan],\n", " [ nan, nan, 0.003931, ..., nan, nan, nan]],\n", " dtype=float32)
array([[ nan, nan, 1.119354, ..., nan, nan, nan],\n", " [ nan, nan, 3.143258, ..., nan, nan, nan],\n", " [ nan, nan, 5.404742, ..., nan, nan, nan],\n", " ...,\n", " [ nan, nan, 1.128974, ..., nan, nan, nan],\n", " [ nan, nan, -1.063081, ..., nan, nan, nan],\n", " [ nan, nan, 2.326698, ..., nan, nan, nan]],\n", " dtype=float32)
array([[ nan, nan, -30.159956, ..., nan, nan,\n", " nan],\n", " [ nan, nan, -28.3329 , ..., nan, nan,\n", " nan],\n", " [ nan, nan, -35.68713 , ..., nan, nan,\n", " nan],\n", " ...,\n", " [ nan, nan, -20.262838, ..., nan, nan,\n", " nan],\n", " [ nan, nan, -63.793026, ..., nan, nan,\n", " nan],\n", " [ nan, nan, nan, ..., nan, nan,\n", " nan]], dtype=float32)
array([[ nan, nan, 68.46817 , ..., nan, nan, nan],\n", " [ nan, nan, 59.172993, ..., nan, nan, nan],\n", " [ nan, nan, 66.57911 , ..., nan, nan, nan],\n", " ...,\n", " [ nan, nan, 15.806147, ..., nan, nan, nan],\n", " [ nan, nan, 33.847023, ..., nan, nan, nan],\n", " [ nan, nan, 7.353924, ..., nan, nan, nan]],\n", " dtype=float32)
array([[ nan, nan, 1.119354, ..., nan, nan, nan],\n", " [ nan, nan, 3.143258, ..., nan, nan, nan],\n", " [ nan, nan, 5.404742, ..., nan, nan, nan],\n", " ...,\n", " [ nan, nan, 1.128974, ..., nan, nan, nan],\n", " [ nan, nan, -1.063081, ..., nan, nan, nan],\n", " [ nan, nan, 2.326698, ..., nan, nan, nan]],\n", " dtype=float32)
array([[ nan, nan, 0.188587, ..., 0.237281, nan, nan],\n", " [ nan, nan, 0.138664, ..., 0.197773, nan, nan],\n", " [ nan, nan, 0.168554, ..., 0.173564, nan, nan],\n", " ...,\n", " [ nan, nan, 0.16697 , ..., nan, nan, nan],\n", " [ nan, nan, 0.247247, ..., nan, nan, nan],\n", " [ nan, nan, 0.026412, ..., nan, nan, nan]],\n", " dtype=float32)
array([[9.96921e+36, 9.96921e+36, 9.96921e+36, ..., 9.96921e+36, 9.96921e+36,\n", " 9.96921e+36],\n", " [9.96921e+36, 9.96921e+36, 9.96921e+36, ..., 9.96921e+36, 9.96921e+36,\n", " 9.96921e+36],\n", " [9.96921e+36, 9.96921e+36, 9.96921e+36, ..., 9.96921e+36, 9.96921e+36,\n", " 9.96921e+36],\n", " ...,\n", " [9.96921e+36, 9.96921e+36, 9.96921e+36, ..., 9.96921e+36, 9.96921e+36,\n", " 9.96921e+36],\n", " [9.96921e+36, 9.96921e+36, 9.96921e+36, ..., 9.96921e+36, 9.96921e+36,\n", " 9.96921e+36],\n", " [9.96921e+36, 9.96921e+36, 9.96921e+36, ..., 9.96921e+36, 9.96921e+36,\n", " 9.96921e+36]], dtype=float32)
array([[ nan, nan, nan, ..., 98.8553 , nan,\n", " nan],\n", " [ nan, nan, nan, ..., 11.278423, nan,\n", " nan],\n", " [ nan, nan, nan, ..., -25.517384, nan,\n", " nan],\n", " ...,\n", " [ nan, nan, -34.673714, ..., nan, nan,\n", " nan],\n", " [ nan, nan, -66.01016 , ..., nan, nan,\n", " nan],\n", " [ nan, nan, -67.23102 , ..., nan, nan,\n", " nan]], dtype=float32)
array([[ 8.721212, nan, 11.599653, ..., -0. , nan, nan],\n", " [ 8.282206, nan, 11.66592 , ..., -0. , nan, nan],\n", " [ 7.710792, nan, 11.447599, ..., -0. , nan, nan],\n", " ...,\n", " [-0. , nan, -8.79652 , ..., -0. , -0. , -0. ],\n", " [-0. , nan, -8.580209, ..., -0. , -0. , -0. ],\n", " [-0. , nan, -8.399653, ..., -0. , -0. , -0. ]],\n", " dtype=float32)
array([[ nan, nan, nan, ..., 0. , nan, nan],\n", " [ nan, nan, nan, ..., 0. , nan, nan],\n", " [ nan, nan, nan, ..., 0. , nan, nan],\n", " ...,\n", " [0. , nan, 6.315117, ..., 0. , 0. , 0. ],\n", " [0. , nan, 6.956841, ..., 0. , 0. , 0. ],\n", " [0. , nan, 5.308681, ..., 0. , 0. , 0. ]],\n", " dtype=float32)
array([[ nan, nan, -0.406208, ..., nan, nan, nan],\n", " [ nan, nan, -0.938196, ..., nan, nan, nan],\n", " [ nan, nan, -0.464067, ..., nan, nan, nan],\n", " ...,\n", " [ nan, nan, -1.533359, ..., nan, nan, nan],\n", " [ nan, nan, -2.515758, ..., nan, nan, nan],\n", " [ nan, nan, -0.859207, ..., nan, nan, nan]],\n", " dtype=float32)
array([[ nan, nan, 0.048146, ..., nan, nan, nan],\n", " [ nan, nan, 0.682183, ..., nan, nan, nan],\n", " [ nan, nan, -0.220659, ..., nan, nan, nan],\n", " ...,\n", " [ nan, nan, 0.408843, ..., nan, nan, nan],\n", " [ nan, nan, 0.308482, ..., nan, nan, nan],\n", " [ nan, nan, -0.25063 , ..., nan, nan, nan]],\n", " dtype=float32)
array([[ nan, nan, -0.498715, ..., -0.914024, nan, nan],\n", " [ nan, nan, -0.464199, ..., -0.92605 , nan, nan],\n", " [ nan, nan, -0.562639, ..., -0.682546, nan, nan],\n", " ...,\n", " [ nan, nan, 0.59202 , ..., nan, nan, nan],\n", " [ nan, nan, 0.006304, ..., nan, nan, nan],\n", " [ nan, nan, -0.017322, ..., nan, nan, nan]],\n", " dtype=float32)
array([[ nan, nan, -1.604266, ..., -1.032957, nan, nan],\n", " [ nan, nan, -1.113737, ..., -0.956631, nan, nan],\n", " [ nan, nan, -1.154891, ..., -0.697563, nan, nan],\n", " ...,\n", " [ nan, nan, 0.956378, ..., nan, nan, nan],\n", " [ nan, nan, 0.014832, ..., nan, nan, nan],\n", " [ nan, nan, -0.091024, ..., nan, nan, nan]],\n", " dtype=float32)
array([[ nan, nan, -0.10888 , ..., -0.034653, nan, nan],\n", " [ nan, nan, -0.066821, ..., -0.033728, nan, nan],\n", " [ nan, nan, -0.086447, ..., 0.011597, nan, nan],\n", " ...,\n", " [ nan, nan, 0.048318, ..., nan, nan, nan],\n", " [ nan, nan, 0.013532, ..., nan, nan, nan],\n", " [ nan, nan, 0.006933, ..., nan, nan, nan]],\n", " dtype=float32)
array([[ nan, nan, 293.81552, ..., 293.75693, nan, nan],\n", " [ nan, nan, 292.8149 , ..., 293.0093 , nan, nan],\n", " [ nan, nan, 291.88367, ..., 291.42538, nan, nan],\n", " ...,\n", " [ nan, nan, 280.16534, ..., nan, nan, nan],\n", " [ nan, nan, 277.7816 , ..., nan, nan, nan],\n", " [ nan, nan, 275.7071 , ..., nan, nan, nan]],\n", " dtype=float32)
array([[ nan, nan, 10.109797, ..., nan, nan, nan],\n", " [ nan, nan, 10.622018, ..., nan, nan, nan],\n", " [ nan, nan, 10.771578, ..., nan, nan, nan],\n", " ...,\n", " [ nan, nan, 6.533478, ..., nan, nan, nan],\n", " [ nan, nan, 7.097571, ..., nan, nan, nan],\n", " [ nan, nan, 6.768535, ..., nan, nan, nan]],\n", " dtype=float32)
array([2019., 2019., 2019., ..., 2019., 2019., 2019.], dtype=float32)
array([ 6., 6., 6., ..., 10., 10., 10.], dtype=float32)
array([20., 20., 20., ..., 14., 14., 14.], dtype=float32)
array([171, 171, 171, ..., 287, 287, 287], dtype=int32)
array([ 0., 0., 1., ..., 22., 23., 23.], dtype=float32)
array([ 0., 30., 0., ..., 30., 0., 30.], dtype=float32)
array([32., 12., 3., 32., 32., 32., 32., 32., 32., 25., 32., 32., 32., 32.,\n", " 3., 12., 32.], dtype=float32)