Exemple #1
0
import datetime
import constants as c
import glob
import logging
import meteorologicalfunctions as mf
import netCDF4
import numpy
import os
import qcio
import qcts
import qcutils
import xlrd

logging.basicConfig()
# open the logging file
log = qcutils.startlog('aws2nc','../logfiles/aws2nc.log')

# dummy control file for FixTimeSteps
cf = {"Options":{"FixTimeStepMethod":"round"}}

# get the site information and the AWS stations to use
xlname = "/home/peter/OzFlux/BoM/AWS_Locations.xls"
wb = xlrd.open_workbook(xlname)
sheet = wb.sheet_by_name("OzFlux")
xl_row = 10
xl_col = 0
bom_sites_info = {}
for n in range(xl_row,sheet.nrows):
    xlrow = sheet.row_values(n)
    bom_sites_info[str(xlrow[0])] = {}
    bom_sites_info[xlrow[0]]["latitude"] = xlrow[1]
import sys
# check the scripts directory is present
if not os.path.exists("../scripts/"):
    print "compare_access: the scripts directory is missing"
    sys.exit()
# since the scripts directory is there, try importing the modules
sys.path.append('../scripts')
import numpy
import matplotlib.pyplot as plt
import meteorologicalfunctions as mf
import statsmodels.api as sm
import qcio
import qcutils

# open the logging file
log = qcutils.startlog('compare_access','../logfiles/compare_access.log')

# load the control file
cf = qcio.load_controlfile(path='../controlfiles')
if len(cf)==0: sys.exit()
tow_name = cf["Files"]["tower_filename"]
acc_name = cf["Files"]["access_filename"]
# read the data series
ds_tow = qcio.nc_read_series(tow_name)
ds_acc = qcio.nc_read_series(acc_name)
# get the time step and the site name
ts = int(ds_tow.globalattributes["time_step"])
site_name = str(ds_tow.globalattributes["site_name"])
# get the start and end indices for the first and last whole days
dt_acc = ds_acc.series["DateTime"]["Data"]
si_acc = qcutils.GetDateIndex(dt_acc,str(dt_acc[0]),ts=ts,match="startnextday")
Exemple #3
0
import sys
sys.path.append('../scripts')
import constants as c
import glob
import meteorologicalfunctions as mf
import netCDF4
import numpy
import os.path
import qcio
import qcutils

# open the logging file
log = qcutils.startlog('bios2nc','../logfiles/bios2nc.log')

# get the control file
cf = qcio.load_controlfile(path='../controlfiles')
if len(cf)==0: sys.exit()
start_date = cf["General"]["start_date"]
end_date = cf["General"]["end_date"]
var_list = cf["Variables"].keys()
site_list = cf["Sites"].keys()
for site in site_list:
    # get the input file mask
    infilename = cf["Sites"][site]["in_filepath"]+cf["Sites"][site]["in_filename"]
    if not os.path.isfile(infilename):
        log.error("netCDF file "+infilename+" not found, skipping ...")
        continue
    log.info("Starting site: "+site)
    # get a data structure
    ds_30 = qcio.DataStructure()
    # get the output file name
Exemple #4
0
import sys
sys.path.append('../scripts')
import constants as c
import glob
import meteorologicalfunctions as mf
import netCDF4
import numpy
import os.path
import qcio
import qcutils

# open the logging file
log = qcutils.startlog('bios2nc','../logfiles/bios2nc.log')

# get the control file
cf = qcio.load_controlfile(path='../controlfiles')
if len(cf)==0: sys.exit()
start_date = cf["General"]["start_date"]
end_date = cf["General"]["end_date"]
var_list = cf["Variables"].keys()
site_list = cf["Sites"].keys()
for site in site_list:
    # get the input file mask
    infilename = cf["Sites"][site]["in_filepath"]+cf["Sites"][site]["in_filename"]
    if not os.path.isfile(infilename):
        log.error("netCDF file "+infilename+" not found, skipping ...")
        continue
    log.info("Starting site: "+site)
    # get a data structure
    ds_30 = qcio.DataStructure()
    # get the output file name