{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# NEON Data\n\nThis example shows how to download data from\nNEON and ARM 2m surface meteorology stations\non the North Slope and plot them\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import glob\nimport os\n\nimport matplotlib.pyplot as plt\n\nimport act\n\n# Place your username and token here\nusername = os.getenv('ARM_USERNAME')\ntoken = os.getenv('ARM_PASSWORD')\n\nif token is not None and len(token) > 0:\n # Download ARM data if a username/token are set\n files = act.discovery.download_arm_data(\n username, token, 'nsametC1.b1', '2022-10-01', '2022-10-07'\n )\n ds = act.io.arm.read_arm_netcdf(files)\n\n # Download NEON Data\n # NEON sites can be found through the NEON website\n # https://www.neonscience.org/field-sites/explore-field-sites\n site_code = 'BARR'\n product_code = 'DP1.00002.001'\n result = act.discovery.neon.download_neon_data(site_code, product_code, '2022-10')\n\n # A number of files are downloaded and further explained in the readme file that's downloaded.\n # These are the files we will need for reading 1 minute NEON data\n file = glob.glob(\n os.path.join(\n '.',\n 'BARR_DP1.00002.001',\n 'NEON.D18.BARR.DP1.00002.001.000.010.001.SAAT_1min.2022-10.expanded.*.csv',\n )\n )\n variable_file = glob.glob(\n os.path.join('.', 'BARR_DP1.00002.001', 'NEON.D18.BARR.DP1.00002.001.variables.*.csv')\n )\n position_file = glob.glob(\n os.path.join(\n '.',\n 'BARR_DP1.00002.001',\n 'NEON.D18.BARR.DP1.00002.001.sensor_positions.*.csv',\n )\n )\n # Read in the data using the ACT reader, passing with it the variable and position files\n # for added information in the dataset\n ds2 = act.io.read_neon_csv(file, variable_files=variable_file, position_files=position_file)\n\n # Plot up the two datasets\n display = act.plotting.TimeSeriesDisplay({'ARM': ds, 'NEON': ds2})\n display.plot('temp_mean', 'ARM', marker=None, label='ARM')\n display.plot('tempSingleMean', 'NEON', marker=None, label='NEON')\n display.day_night_background('ARM')\n plt.show()" ] } ], "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.14.3" } }, "nbformat": 4, "nbformat_minor": 0 }