#import types # to add precip conversion fct. to datasets #from importlib import import_module # internal imports from geodata.base import Variable, Axis from geodata.netcdf import DatasetNetCDF from geodata.gdal import addGDALtoDataset, GridDefinition, loadPickledGridDef, addGeoLocator from geodata.misc import DatasetError from utils.nctools import writeNetCDF from datasets.common import getRootFolder, grid_folder, transformPrecip, timeSlice from datasets.common import translateVarNames, loadObservations, addLandMask, addLengthAndNamesOfMonth, getFileName from processing.process import CentralProcessingUnit ## GPCC Meta-data dataset_name = 'GPCC' root_folder = getRootFolder(dataset_name=dataset_name) # get dataset root folder based on environment variables # GPCC grid definition geotransform_025 = (-180.0, 0.25, 0.0, -90.0, 0.0, 0.25) size_025 = (1440,720) # (x,y) map size geotransform_05 = (-180.0, 0.5, 0.0, -90.0, 0.0, 0.5) size_05 = (720,360) # (x,y) map size geotransform_10 = (-180.0, 1.0, 0.0, -90.0, 0.0, 1.0) size_10 = (360,180) # (x,y) map size geotransform_25 = (-180.0, 2.5, 0.0, -90.0, 0.0, 2.5) size_25 = (144,72) # (x,y) map size # make GridDefinition instance GPCC_025_grid = GridDefinition(name='GPCC_025',projection=None, geotransform=geotransform_025, size=size_025) GPCC_05_grid = GridDefinition(name='GPCC_05',projection=None, geotransform=geotransform_05, size=size_05) GPCC_10_grid = GridDefinition(name='GPCC_10',projection=None, geotransform=geotransform_10, size=size_10)
import numpy as np import pandas as pd import scipy.interpolate as si import os from warnings import warn # internal imports from datasets.common import BatchLoad, getRootFolder from geodata.base import Dataset, Variable, Axis, concatDatasets from geodata.misc import ArgumentError, VariableError, DataError, isNumber, DatasetError from datasets.WSC import getGageStation, GageStationError, loadWSC_StnTS, updateScalefactor import datetime as dt ## HGS Meta-data dataset_name = 'HGS' root_folder = getRootFolder(dataset_name=dataset_name, fallback_name='WRF') # get dataset root folder based on environment variables prefix_file = 'batch.pfx' # text file that contians the HGS problem prefix (also HGS convention) # variable attributes and name variable_attributes = dict(sfroff = dict(name='sfroff', units='kg/m^2/s', atts=dict(long_name='Surface Runoff')), # surface flow rate over area ugroff = dict(name='ugroff', units='kg/m^2/s', atts=dict(long_name='Subsurface Runoff')), # subsurface flow rate over area runoff = dict(name='runoff', units='kg/m^2/s', atts=dict(long_name='Total Runoff')), # total flow rate over area discharge = dict(name='discharge', units='kg/s', atts=dict(long_name='Surface Flow Rate')), # surface flow rate seepage = dict(name='seepage' , units='kg/s', atts=dict(long_name='Subsurface Flow Rate')), # subsurface flow rate flow = dict(name='flow' , units='kg/s', atts=dict(long_name='Total Flow Rate')), ) # total flow rate # list of variables to load variable_list = variable_attributes.keys() # also includes coordinate fields flow_to_flux = dict(discharge='sfroff', seepage='ugroff', flow='runoff') # relationship between flux and flow variables # N.B.: computing surface flux rates from gage flows also requires the drainage area hgs_varlist = ['time','discharge','seepage','flow'] # internal use only; needs to have 'time' hgs_variables = {'surface':'discharge','porous media':'seepage','total':'flow'} # mapping of HGS variable names GeoPy conventions
#external imports import numpy as np import os # from atmdyn.properties import variablePlotatts from geodata.base import Axis from geodata.netcdf import DatasetNetCDF from geodata.gdal import addGDALtoDataset, getProjFromDict, GridDefinition from geodata.misc import DatasetError from datasets.common import translateVarNames, name_of_month, getRootFolder, loadObservations, grid_folder from processing.process import CentralProcessingUnit ## NARR Meta-data dataset_name = 'NARR' root_folder = getRootFolder(dataset_name=dataset_name) # get dataset root folder based on environment variables # NARR projection projdict = dict(proj = 'lcc', # Lambert Conformal Conic lat_1 = 50., # Latitude of first standard parallel lat_2 = 50., # Latitude of second standard parallel lat_0 = 50., # Latitude of natural origin lon_0 = -107.) # Longitude of natural origin # # x_0 = 5632642.22547, # False Origin Easting # y_0 = 4612545.65137) # False Origin Northing # NARR grid definition projection = getProjFromDict(projdict) geotransform = (-5648873.5, 32463.0, 0.0, -4628776.5, 0.0, 32463.0) size = (349, 277) # (x,y) map size of NARR grid # make GridDefinition instance