HWRF  trunk@4391
Public Member Functions | Public Attributes | Properties | List of all members
hwrf.regrib.GRIB2Product Class Reference

This class represents a GRIB2 file that is produced by this workflow. More...

Detailed Description

This class represents a GRIB2 file that is produced by this workflow.

It is a direct subclass of both GRIB2File and FileProduct.

Definition at line 1963 of file regrib.py.

Inheritance diagram for hwrf.regrib.GRIB2Product:
produtil.datastore.FileProduct hwrf.regrib.GRIB2File produtil.datastore.Product hwrf.regrib.GRIB2Op produtil.datastore.Datum hwrf.regrib.GRIBOp hwrf.regrib.GRIBBase

Public Member Functions

def __init__ (self, dstore, args, kwargs)
 Creates a new GRIB2Product. More...
 
def input_valid (self, kwargs)
 Returns True. More...
 
def is_ready (self, args, kwargs)
 Calls self.check to see if the product is available. More...
 
def make (self, regrib, args, kwargs)
 Calls deliver_file to copy the file to a new temporary location from regrib.gribtemp. More...
 
def setgrib2grid (self, grid)
 Sets the grib2 grid information. More...
 
def getgrib2grid (self)
 Returns the grib2 grid information. More...
 
def delgrib2grid (self)
 Clears the grib2 grid information. More...
 
def setgrib2index (self, index)
 Sets the grib2 index information. More...
 
def getgrib2index (self)
 Gets the grib2 index information, or returns None if unknown. More...
 
def delgrib2index (self)
 Cleares the stored information about the index location. More...
 
def getgrib2file (self)
 Returns the location of the GRIB2 file from self.location. More...
 
def setgrib2file (self, val)
 Sets the location of the GRIB2 file by setting self.location. More...
 
def deliver
 Delivers a GRIB2 file to its destination. More...
 
def undeliver (self)
 Deletes the delivered GRIB2 file and discards the index and grid information. More...
 
- Public Member Functions inherited from produtil.datastore.FileProduct
def undeliver
 Undoes the effect of deliver() More...
 
def deliver
 Delivers the file to a destination. More...
 
- Public Member Functions inherited from produtil.datastore.Product
def add_callback
 Adds a delivery callback function. More...
 
def has_callbacks (self)
 Returns True if this Product has any callback functions and False otherwise.
 
def call_callbacks
 Calls all delivery callback functions. More...
 
def check (self, kwargs)
 Asks the product to check its own availability and update the database. More...
 
def deliver (self, kwargs)
 Asks the Product to deliver itself. More...
 
def undeliver (self, kwargs)
 "Undelivers" a product. More...
 
def setavailable (self, val)
 Sets the availability to the specified value. More...
 
def is_available (self)
 Is the product available? More...
 
def validate (self)
 Validates this object's Datastore, prodname and category. More...
 
- Public Member Functions inherited from produtil.datastore.Datum
def __init__ (self, dstore, prodname, category, meta=None, cache=30, location=None, kwargs)
 Datum constructor. More...
 
def __enter__ (self)
 Acquires this object's thread lock. More...
 
def __exit__ (self, etype, evalue, traceback)
 Releases this object's thread lock. More...
 
def validate (self)
 Validates this object's Datastore, prodname and category. More...
 
def getid (self)
 Returns the database ID of this datum. More...
 
def getdatastore (self)
 Returns the datastore of this datum. More...
 
def transaction (self)
 Creates, but does not lock, a Transaction for this datum's datastore. More...
 
def getprodtype (self)
 Returns the product type of this Datum. More...
 
def getprodname (self)
 Returns the product name part of the database ID. More...
 
def getcategory (self)
 Returns the product category part of the database ID. More...
 
def getlocation (self)
 Returns the "location" field of this Datum's database entry. More...
 
def setlocation (self, v)
 Sets the "location" field of this Datum's database entry. More...
 
def __hash__ (self)
 Integer hash function. More...
 
def __str__ (self)
 Human-readable description of this Datum. More...
 
def __repr__ (self)
 Python code-like description of this Datum. More...
 
def __cmp__ (self, other)
 Compares two Datums' prodnames and categories. More...
 
def set_loc_avail (self, loc, avail)
 Sets the location and availability of this Datum in a single transaction. More...
 
def update (self)
 Discards all cached metadata and refreshes it from the Datastore. More...
 
def __getitem__ (self, k)
 Returns the value of the specified metadata key or raises KeyError. More...
 
def meta
 Return the value of a metadata key. More...
 
def get
 Alias for self.meta() Returns the value of the specified metadata key or returns default if it is unset. More...
 
def __setitem__ (self, k, v)
 Sets the value of the specified metadata key. More...
 
def __delitem__ (self, k)
 Deletes the specified metadata key, which must not be "available" or "location". More...
 
def __contains__ (self, k)
 Determines if a metadata key is set. More...
 
def iteritems (self)
 Iterates over all metadata (key,value) pairs for this Datum, including "available" and "location". More...
 
- Public Member Functions inherited from hwrf.regrib.GRIB2File
def __init__ (self, grib2file, grib2index, grib2grid)
 GRIB2File constructor. More...
 
def is_ready (self, args, kwargs)
 Returns True. More...
 
def input_valid (self, kwargs)
 Returns True. More...
 
def make (self, args, kwargs)
 Returns self. More...
 
def getgrib2file (self)
 Returns the GRIB2 file's location. More...
 
def getgrib2index (self)
 This is a placeholder for future development. More...
 
def getgrib2grid (self)
 This is a placeholder for future development. More...
 
- Public Member Functions inherited from hwrf.regrib.GRIB2Op
def __init__ (self, action, args)
 GRIB2Op constructor. More...
 
def to_grib1 (self)
 Returns a GRIB2Op that converts this operation's output to GRIB1.
 
def to_grib2 (self)
 Returns self (converting GRIB2 to GRIB2 is a no-op)
 
def __mul__ (self, grid)
 If grid is the special constant GRIB1, this is the same as to_grib1(), if GRIB2, then returns self. More...
 
- Public Member Functions inherited from hwrf.regrib.GRIBOp
def __init__ (self, action, args)
 Creates a GRIBOp that has a number of child GRIBBase objects, with a specified action to perform in the GRIBOp.make method. More...
 
def getaction (self)
 Returns the action, a function or callable object. More...
 
def args (self)
 Iterates over all child GRIBBase objects. More...
 
def is_ready (self, args, kwargs)
 Returns the logical "and" of is_ready(*args,**kwargs) called on all subobjects. More...
 
def input_valid (self, kwargs)
 Returns the logical "and" of input_valid(**kwargs) called on all subobjects. More...
 
def make (self, regrib, kwargs)
 Runs the action specified in the constructor, providing as arguments regrib, and the result of running make on all of the other arguments sent to the constructor. More...
 
def __repr__ (self)
 A string representation of this GRIB operation. More...
 
- Public Member Functions inherited from hwrf.regrib.GRIBBase
def is_ready (self, args, kwargs)
 Returns True if this object and its subobjects are all ready for a call to make, and False otherwise. More...
 
def input_valid (self, kwargs)
 Returns True if the specified kwargs are valid and False otherwise. More...
 
def make (self, regrib, kwargs)
 Runs the action this object should perform and returns another GRIBBase object. More...
 

Public Attributes

 location
 
 available
 
- Public Attributes inherited from produtil.datastore.FileProduct
 available
 

Properties

 grib2grid
 The GRIB2 grid information if known. More...
 
 grib2index
 The disk location of the GRIB2 index file. More...
 
 grib2file
 The location of the grib2 file, synonym for self.location. More...
 
 resultfile
 The location of the grib2 file, synonym for self.location. More...
 
- Properties inherited from produtil.datastore.Product
 available
 Read-write property: is the product available? More...
 
- Properties inherited from produtil.datastore.Datum
 prodname = property(getprodname,None,None,)
 Read-only property, an alias for getprodname(): the product name part of the database ID. More...
 
 category = property(getcategory,None,None,)
 Read-only property, an alias for getcategory(), the category name part of the database ID. More...
 
 prodtype
 Read-only property, an alias for getprodtype(), the product type. More...
 
 did
 Read-only property, an alias for getid(). More...
 
 dstore
 Read-only property, an alias for getdatastore(), the Datastore in which this Datum resides. More...
 
 location
 Read-write property, an alias for getlocation() and setlocation(). More...
 
- Properties inherited from hwrf.regrib.GRIB2File
 resultfile
 The path to the result file, in this case the GRIB2 file. More...
 
 grib2file
 The path to the GRIB2 file which is assumed to already exist. More...
 
 grib2index
 This is a placeholder for future GRIB2 subsetting support. More...
 
 grib2grid
 This is a placeholder for future GRIB2 regridding support. More...
 
- Properties inherited from hwrf.regrib.GRIBOp
 action
 A read-only property: this objects action function. More...
 

Constructor & Destructor Documentation

def hwrf.regrib.GRIB2Product.__init__ (   self,
  dstore,
  args,
  kwargs 
)

Creates a new GRIB2Product.

Parameters
dstoreThe dstore is the produtil.datastore.Datastore for database storage.
args,kwargsAll other arguments are passed on to FileProduct's constructor.
Note
The GRIB2File constructor is initialized with None for the file, index and grid.

Definition at line 1967 of file regrib.py.

Member Function Documentation

def hwrf.regrib.GRIB2Product.delgrib2grid (   self)

Clears the grib2 grid information.

Definition at line 2015 of file regrib.py.

def hwrf.regrib.GRIB2Product.delgrib2index (   self)

Cleares the stored information about the index location.

Does NOT delete the index file.

Definition at line 2031 of file regrib.py.

def hwrf.regrib.GRIB2Product.deliver (   self,
  location = None,
  index = None,
  grbindex = None,
  frominfo = None,
  keep = True,
  logger = None 
)

Delivers a GRIB2 file to its destination.

May also deliver other files associated with that GRIB2 file.

Parameters
locationDelivery location.
indexIndex file delivery location
grbindexIgnored.
frominfoEither a source filename, or a GRIB2Op.
keepIf True, the source file will be copied instead of moved.
loggerA logging.Logger for log information.

Definition at line 2059 of file regrib.py.

def hwrf.regrib.GRIB2Product.getgrib2file (   self)

Returns the location of the GRIB2 file from self.location.

Definition at line 2041 of file regrib.py.

def hwrf.regrib.GRIB2Product.getgrib2grid (   self)

Returns the grib2 grid information.

Definition at line 2012 of file regrib.py.

def hwrf.regrib.GRIB2Product.getgrib2index (   self)

Gets the grib2 index information, or returns None if unknown.

Definition at line 2028 of file regrib.py.

def hwrf.regrib.GRIB2Product.input_valid (   self,
  kwargs 
)

Returns True.

Since this object is already its product, any kwargs make a valid input.

Parameters
kwargsIgnored.

Definition at line 1981 of file regrib.py.

def hwrf.regrib.GRIB2Product.is_ready (   self,
  args,
  kwargs 
)

Calls self.check to see if the product is available.

Parameters
argsAdditional positional arguments are ignored.
kwargsAdditional keyword arguments. If frominfo is in the kwargs, it is passed as the first positional argument to check.

Definition at line 1986 of file regrib.py.

def hwrf.regrib.GRIB2Product.make (   self,
  regrib,
  args,
  kwargs 
)

Calls deliver_file to copy the file to a new temporary location from regrib.gribtemp.

Returns a GRIB2File for that temporary file.

Parameters
regribA Regrib for data storage
args,kwargsAll other arguments are ignored.

Definition at line 1997 of file regrib.py.

def hwrf.regrib.GRIB2Product.setgrib2file (   self,
  val 
)

Sets the location of the GRIB2 file by setting self.location.

Definition at line 2044 of file regrib.py.

def hwrf.regrib.GRIB2Product.setgrib2grid (   self,
  grid 
)

Sets the grib2 grid information.

Parameters
gridGRIB2 grid information.

Definition at line 2007 of file regrib.py.

def hwrf.regrib.GRIB2Product.setgrib2index (   self,
  index 
)

Sets the grib2 index information.

Definition at line 2024 of file regrib.py.

def hwrf.regrib.GRIB2Product.undeliver (   self)

Deletes the delivered GRIB2 file and discards the index and grid information.

Definition at line 2118 of file regrib.py.

Property Documentation

hwrf.regrib.GRIB2Product.grib2file
static
Initial value:
1 = property(getgrib2file,setgrib2file,None,
2  )

The location of the grib2 file, synonym for self.location.

Definition at line 2050 of file regrib.py.

hwrf.regrib.GRIB2Product.grib2grid
static
Initial value:
1 = property(getgrib2grid,setgrib2grid,delgrib2grid,
2  )

The GRIB2 grid information if known.

Definition at line 2021 of file regrib.py.

hwrf.regrib.GRIB2Product.grib2index
static
Initial value:
1 = property(getgrib2index,setgrib2index,delgrib2index,
2  )

The disk location of the GRIB2 index file.

Definition at line 2038 of file regrib.py.

hwrf.regrib.GRIB2Product.resultfile
static
Initial value:
1 = property(getgrib2file,setgrib2file,None,
2  )

The location of the grib2 file, synonym for self.location.

Definition at line 2055 of file regrib.py.


The documentation for this class was generated from the following file: