or contained herein. ****************************************************************************""" from base64 import b64decode as readpassword import psycopg2 as DBase # PostgreSQL Connection import matplotlib.pyplot as draw # Plotting operations import matplotlib.dates as mdates # Format Plot Date import numpy # Plot Statistics """GLOBAL-VARiABLES--------------------------------------------------------- """ # Database Connection Parameters host = r'thor.gi.alaska.edu' base = r'spatial_database' user = r'guest' word = readpassword(r'Z3Vlc3Q=') # Folder Paths: Local - local file folder local_folder = r'A:\Desktop\Test' # Local Folder # Plot Labels and Titles label = {'ylabel': 'cm w.e. (SUM)', 'xlabel': 'Date (Year)'} # Region Lookup regions = { 'region1': (1442, 1443, 1446, 1447, 1452, 1453, 1462, 1463, 1471, 1472), 'region2': (1479, 1480, 1481, 1473), 'region3': (1482, 1483, 1484, 1485), 'region4': (1454, 1455, 1464, 1465, 1466, 1474, 1475), # CHUGACH 'region5': (1476, 1477), 'region6':
import psycopg2 as DBase # PostgreSQL Connection import matplotlib.pyplot as draw # Plotting operations import matplotlib.dates as mdates # Format Plot Date import numpy # Plot Statistics """GLOBAL-VARiABLES--------------------------------------------------------- """ # Database Connection Parameters host = r'thor.gi.alaska.edu' base = r'spatial_database' user = r'guest' word = readpassword(r'Z3Vlc3Q=') # Folder Paths: Local - local file folder local_folder = r'A:\Desktop\Test' # Local Folder # Plot Labels and Titles label = {'ylabel': 'cm w.e. (SUM)', 'xlabel': 'Date (Year)'} # Region Lookup regions = {'region1': (1442,1443,1446,1447,1452,1453,1462,1463,1471,1472), 'region2': (1479,1480,1481,1473), 'region3': (1482,1483,1484,1485), 'region4': (1454,1455,1464,1465,1466,1474,1475), # CHUGACH 'region5': (1476,1477), 'region6': (1456,1457,1458,1459,1448,1449,1467,1468,1469,1470,1478), # WRST
import paramiko # SSH Connection import matplotlib.pyplot as draw # Plotting operations import matplotlib.dates as mdates # Format Plot Date import numpy # Plot Statistics """------------------------------------------------------------------------- """ """ Initialize variables and set switches open / closed""" num_days = 30 # number of days to plot (current - n) # Database Connection Parameters host = r'thor.gi.alaska.edu' base = r'spatial_database' user = r'guest' word = readpassword(r'Z3Vlc3Q=') # Secure Shell Connection Parameters ssh_ftp = r'ftp.gi.alaska.edu' ssh_port = 22 ssh_user = r'jrich' ssh_word = readpassword(r'SkxSaWNoMjAxMA==') # Folder Paths: Local - local file folder and Server is the folder on the web server local_folder = r'A:\Project_Database\Website\web_images\weatherstations' # Local Folder server_folder = r'public_html/web_images/weatherstations' # Server Folder # Weather Stations to be plotted weather_stations = ['ValdezCRREL', 'CordovaCRREL', 'ColumbiaCRREL'] # Process Switches True is open and False is closed
Copyright: (c) Justin L. Rich 2014 License: Although this application has been produced and tested successfully, no warranty expressed or implied is made regarding the reliability and accuracy of the utility, or the data produced by it, on any other system or for general or scientific purposes, nor shall the act of distribution constitute any such warranty. It is also strongly recommended that careful attention be paid to the contents of the metadata / help file associated with these data to evaluate application limitations, restrictions or intended use. The creators and distributors of the application shall not be held liable for improper or incorrect use of the utility described and/ or contained herein. ****************************************************************************""" import psycopg2 as DBase # PostgreSQL Connection from base64 import b64decode as readpassword # Database Connection Parameters host = r'thor.gi.alaska.edu' base = r'spatial_database' user = r'script' word = readpassword(r'c2NyaXB0') connection = DBase.connect(" host='%s' dbname='%s' user='******' password='******'" %(host, base, user, word)) cursor = connection.cursor() # Cursor object #Remove negative -9999 from columns and replace it with null cursor.execute("""UPDATE weatherstation_data SET solar_radiation_in = NULL WHERE solar_radiation_in = -9999; """) cursor.execute("""UPDATE weatherstation_data SET solar_radiation_out = NULL WHERE solar_radiation_out = -9999;""") cursor.execute("""UPDATE weatherstation_data SET wind_speed = NULL WHERE wind_speed = -9999;""") cursor.execute("""UPDATE weatherstation_data SET wind_direction = NULL WHERE wind_direction = -9999;""") connection.close() # Close Database Connection
import matplotlib.pyplot as draw # Plotting operations import matplotlib.dates as mdates # Format Plot Date import numpy # Plot Statistics """------------------------------------------------------------------------- """ """ Initialize variables and set switches open / closed""" num_days = 30 # number of days to plot (current - n) # Database Connection Parameters host = r'thor.gi.alaska.edu' base = r'spatial_database' user = r'guest' word = readpassword(r'Z3Vlc3Q=') # Secure Shell Connection Parameters ssh_ftp = r'ftp.gi.alaska.edu' ssh_port = 22 ssh_user = r'jrich' ssh_word = readpassword(r'SkxSaWNoMjAxMA==') # Folder Paths: Local - local file folder and Server is the folder on the web server local_folder = r'A:\Project_Database\Website\web_images\weatherstations' # Local Folder server_folder = r'public_html/web_images/weatherstations' # Server Folder # Weather Stations to be plotted weather_stations = ['ValdezCRREL', 'CordovaCRREL', 'ColumbiaCRREL'] # Process Switches True is open and False is closed
other system or for general or scientific purposes, nor shall the act of distribution constitute any such warranty. It is also strongly recommended that careful attention be paid to the contents of the metadata / help file associated with these data to evaluate application limitations, restrictions or intended use. The creators and distributors of the application shall not be held liable for improper or incorrect use of the utility described and/ or contained herein. ****************************************************************************""" import psycopg2 as DBase # PostgreSQL Connection from base64 import b64decode as readpassword # Database Connection Parameters host = r'thor.gi.alaska.edu' base = r'spatial_database' user = r'script' word = readpassword(r'c2NyaXB0') connection = DBase.connect(" host='%s' dbname='%s' user='******' password='******'" % (host, base, user, word)) cursor = connection.cursor() # Cursor object #Remove negative -9999 from columns and replace it with null cursor.execute( """UPDATE weatherstation_data SET solar_radiation_in = NULL WHERE solar_radiation_in = -9999; """ ) cursor.execute( """UPDATE weatherstation_data SET solar_radiation_out = NULL WHERE solar_radiation_out = -9999;""" ) cursor.execute( """UPDATE weatherstation_data SET wind_speed = NULL WHERE wind_speed = -9999;""" )