Ejemplo n.º 1
0
import sys
import numpy as np
from ecmwfapi import ECMWFDataServer
import cesm_nc_manager as cnm

# Get command line arguments
print sys.argv
VAR         = sys.argv[1]       # The name of the variable, will be the save name
startYear   = int(sys.argv[2])  # First year of data request downloads
endYear     = int(sys.argv[3])  # Last year of data request will download
levtype     = sys.argv[4]       #"sfc" # "pl"
gridSpacing = "0.75/0.75"       # "0.75/0.75" | "1.50/1.50"


# Figures out what hardrive to use as root
drive = cnm.getDrive()
if gridSpacing == "0.75/0.75":
	DataDir = drive + "era_interim_nc_6_hourly/"
else:
	DataDir = drive + "era_interim_nc_6_hourly_1_5/"


# Set years for script to work on
nYears = (endYear - startYear) + 1
yearArray = np.arange(startYear, endYear+1)

# Connect to the server
server = ECMWFDataServer()

# get param based on dictionary
# TODO: UPDATE once the better names are known
Ejemplo n.º 2
0
    getBurnArea = False

else:
    # Development environment. Set variables manually here.
    year = str(2002)
    inventory = 'GFED4s'  # FINN | GFED4s | HMS
    METGrid = 'ecmwf'  #
    species = 'monthly_DM'  # Either CO2 or a specific vegetation type or C for GFED, SPDH
    getBurnArea = True  # Only works for monthly data...Will get burn area from C or DM monthly files

# When this is true extra plots are made to ensure that the grids are being
# handled correctly. These were examined during development
sanityCheck = False

# Figure out what machine this code is running on. Set file paths.
dataDir = cnm.getDrive()

# Get the era-interim (or other MET grid). They ALL live on the same grid, except
# time
# TODO: Handle time matching in this script as well!
metFile = dataDir + 'era_interim_nc_daily/sp_' + year + '.nc'
met_nc = Dataset(metFile, 'r')
met_lat = met_nc.variables['latitude'][:]
met_lon = met_nc.variables['longitude'][:]
met_time = met_nc.variables['time'][:]
sp_slice = met_nc.variables['sp'][180, :, :]
met_nc.close()

if sanityCheck:
    m = Basemap(projection='robin', lon_0=0, resolution='c')
    lons, lats = np.meshgrid(met_lon, met_lat)