From 162ec53f940eaaa50205627109aeab682919ceec Mon Sep 17 00:00:00 2001 From: mshoffner2 Date: Mon, 23 Sep 2019 14:42:51 +0000 Subject: [PATCH] Completing miniproject 2 --- MDSMongoDB.ipynb | 120 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 MDSMongoDB.ipynb diff --git a/MDSMongoDB.ipynb b/MDSMongoDB.ipynb new file mode 100644 index 0000000..f0f7a22 --- /dev/null +++ b/MDSMongoDB.ipynb @@ -0,0 +1,120 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pprint\n", + "import re\n", + "import pymongo, json\n", + "\n", + "pp = pprint.PrettyPrinter(indent=1,width=65)\n", + "\n", + "client = pymongo.MongoClient (host=\"da1.eecs.utk.edu\")\n", + "db = client ['fdac19mp2']\n", + "coll = db ['mshoffn2']\n", + "# for each dataset\n", + "coll.insert_one ( { 'topic':'temperature data', 'first dataset': 'USA temp records', 'license': 'NA', 'description': 'Datasets found on temperature records', 'urls': [ 'https://data.doi.gov/dataset/fiber-optic-distributed-temperature-data-collected-along-the-streambed-of-ellerbe-creek-durham-', 'https://catalog.data.gov/dataset/water-temperature-in-three-sisters-springs-and-water-temperature-and-level-in-magnolia-2014-15', 'https://data.wu.ac.at/schema/geothermaldata_org/NDRiN2M4YjMtNjM5Mi00OTdjLWFmMTUtZmY0NWJmMWM2ZTQx', 'http://datadiscoverystudio.org/geoportal/rest/metadata/item/6d922b4eec724c5b8085e9f264254546/html', 'https://catalog.data.gov/dataset/u-s-monthly-climate-normals-1971-2000', 'https://cmr.earthdata.nasa.gov/search/concepts/C1214584999-SCIOPS', 'https://data.nodc.noaa.gov/cgi-bin/iso?id=gov.noaa.nodc:0174810', 'https://catalog.data.gov/dataset/climate-prediction-center-cpc-three-month-probabilistic-temperature-outlook-for-the-contiguous-', 'https://catalog.data.gov/dataset/92803ec6-65d8-4d6e-bbe5-5517b7d28123', 'https://www.statista.com/statistics/513644/monthly-average-temperature-in-the-us-celsius/', 'https://catalog.data.gov/dataset/03beae5a-9ed5-4e3b-abd0-4355ceeaf53c', 'https://catalog.data.gov/dataset/u-s-local-climatological-data-lcd', 'https://plos.figshare.com/articles/Heat_in_the_southeastern_United_States_Characteristics_trends_and_potential_health_impact/5011409' ] } )\n" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'_id': ObjectId('5d88d7d5c6cd68b894a43b3a'),\n", + " 'description': 'Datasets found on temperature records',\n", + " 'first dataset': 'Southeast USA',\n", + " 'license': 'NA',\n", + " 'topic': 'temperature data',\n", + " 'urls': ['https://catalog.data.gov/dataset/u-s-local-climatological-data-lcd',\n", + " 'https://plos.figshare.com/articles/Heat_in_the_southeastern_United_States_Characteristics_trends_and_potential_health_impact/5011409']}\n", + "{'_id': ObjectId('5d88d83cc6cd68b894a43b3d'),\n", + " 'description': 'Datasets found on temperature records',\n", + " 'first dataset': 'Southeast USA',\n", + " 'license': 'NA',\n", + " 'topic': 'temperature data',\n", + " 'urls': ['https://catalog.data.gov/dataset/92803ec6-65d8-4d6e-bbe5-5517b7d28123',\n", + " 'https://www.statista.com/statistics/513644/monthly-average-temperature-in-the-us-celsius/',\n", + " 'https://catalog.data.gov/dataset/03beae5a-9ed5-4e3b-abd0-4355ceeaf53c',\n", + " 'https://catalog.data.gov/dataset/u-s-local-climatological-data-lcd',\n", + " 'https://plos.figshare.com/articles/Heat_in_the_southeastern_United_States_Characteristics_trends_and_potential_health_impact/5011409']}\n", + "{'_id': ObjectId('5d88d904c6cd68b894a43b40'),\n", + " 'description': 'Datasets found on temperature records',\n", + " 'first dataset': 'USA temp records',\n", + " 'license': 'NA',\n", + " 'topic': 'temperature data',\n", + " 'urls': ['https://data.wu.ac.at/schema/geothermaldata_org/NDRiN2M4YjMtNjM5Mi00OTdjLWFmMTUtZmY0NWJmMWM2ZTQx',\n", + " 'http://datadiscoverystudio.org/geoportal/rest/metadata/item/6d922b4eec724c5b8085e9f264254546/html',\n", + " 'https://catalog.data.gov/dataset/u-s-monthly-climate-normals-1971-2000',\n", + " 'https://cmr.earthdata.nasa.gov/search/concepts/C1214584999-SCIOPS',\n", + " 'https://data.nodc.noaa.gov/cgi-bin/iso?id=gov.noaa.nodc:0174810',\n", + " 'https://catalog.data.gov/dataset/climate-prediction-center-cpc-three-month-probabilistic-temperature-outlook-for-the-contiguous-',\n", + " 'https://catalog.data.gov/dataset/92803ec6-65d8-4d6e-bbe5-5517b7d28123',\n", + " 'https://www.statista.com/statistics/513644/monthly-average-temperature-in-the-us-celsius/',\n", + " 'https://catalog.data.gov/dataset/03beae5a-9ed5-4e3b-abd0-4355ceeaf53c',\n", + " 'https://catalog.data.gov/dataset/u-s-local-climatological-data-lcd',\n", + " 'https://plos.figshare.com/articles/Heat_in_the_southeastern_United_States_Characteristics_trends_and_potential_health_impact/5011409']}\n" + ] + } + ], + "source": [ + "import pprint\n", + "import pymongo, json\n", + "client = pymongo.MongoClient (host=\"da1.eecs.utk.edu\")\n", + "db = client ['fdac19mp2']\n", + "coll = db ['mshoffn2']\n", + "pp = pprint.PrettyPrinter(indent=1,width=65)\n", + "for r in coll. find():\n", + " print(pp .pformat (r)) " + ] + }, + { + "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.7" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +}