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

This class represents a GRIB1 file produced by this workflow. More...

Detailed Description

This class represents a GRIB1 file produced by this workflow.

It stores grid information, if available, and will also deliver an index file if one exists. It is a direct subclass of both FileProduct and GRIB1File.

Definition at line 2132 of file regrib.py.

Inheritance diagram for hwrf.regrib.GRIB1Product:
produtil.datastore.FileProduct hwrf.regrib.GRIB1File produtil.datastore.Product hwrf.regrib.GRIB1Op produtil.datastore.Datum hwrf.regrib.GRIBOp hwrf.regrib.GRIBBase

Public Member Functions

def __init__ (self, dstore, args, kwargs)
 Creates a new GRIB1Product. More...
 
def input_valid (self, kwargs)
 Returns True. More...
 
def is_ready (self, args, kwargs)
 Runs self.check and returns the result. More...
 
def make (self, regrib, args, kwargs)
 Gets a temporary filename from gribtemp, and copies the GRIB1 file there. More...
 
def setgrib1grid (self, grid)
 Sets the GRIB1 grid information; modifies the grib1grid metadata in the datastore. More...
 
def getgrib1grid (self)
 Returns the GRIB1 grid information from the grib1grid metadata in the datastore. More...
 
def delgrib1grid (self)
 Discards GRIB1 grid information by removing the grib1grid metadata from the datastore. More...
 
def setgrib1grbindex (self, index)
 Sets the output location of grbindex to the given location, and sets the grib1grbindex metadata value. More...
 
def getgrib1grbindex (self)
 Returns the output location of grbindex from the grib1grbindex metadata value. More...
 
def delgrib1grbindex (self)
 Cleares the stored information about the grbindex binary index file location for this GRIB1 product by deleting the grib1grbindex metadata value. More...
 
def setgrib1index (self, index)
 Sets the output location of wgrib -s and sets the grib1index metadata value. More...
 
def getgrib1index (self)
 Returns the output location of wgrib -s from the grib1index metadata value. More...
 
def delgrib1index (self)
 Cleares the stored information about the index location. More...
 
def getgrib1file (self)
 Returns the GRIB1 file location from self.location. More...
 
def setgrib1file (self, val)
 Sets the GRIB1 file location. More...
 
def deliver
 Delivers the GRIB1 data, and possibly the various index files as well. More...
 
def undeliver (self)
 Undoes the effect of deliver(), removing the destination index files and GRIB file. 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.GRIB1File
def __init__
 GRIB1File constructor. More...
 
def input_valid (self, kwargs)
 Returns True. More...
 
def is_ready (self, args, kwargs)
 Returns True. More...
 
def make (self, args, kwargs)
 Returns self. More...
 
def getnscenter (self)
 Returns the domain center latitude. More...
 
def getewcenter (self)
 Returns the domain center longitude. More...
 
def getgrib1file (self)
 Returns the GRIB1 file's location. More...
 
def getgrib1index (self)
 Returns the location of the file that stores the output of wgrib -s. More...
 
def getgrib1grbindex (self)
 Returns the location of the file that stores the output of the grbindex program run on the GRIB1 file. More...
 
def setgrib1grbindex (self, here)
 Sets the location of the file that stores the output of the grbindex program run on the GRIB1 file. More...
 
def getgrib1grid (self)
 Returns the GRIB1 grid information as a string. More...
 
def wgrib_s (self, regrib)
 Returns the output of wgrib -s run on this file, which may be from cached data. More...
 
- Public Member Functions inherited from hwrf.regrib.GRIB1Op
def __init__ (self, action, args)
 Creates a new GRIB1Op, passing all arguments to the superclass constructor. More...
 
def to_grib1 (self)
 Returns self. More...
 
def to_grib2 (self)
 Returns a GRIB2Op that will make a GRIB2 version of this operation's output. More...
 
def regridmerge (self, grid, other)
 Returns a GRIB1Op that will ask copygb to merge the other grid on top of this one. More...
 
def make_grbindex (self)
 Returns a GRIB1Op that will run grbindex and save the results, unless that has already been done. More...
 
def __div__ (self, subsetter)
 Returns a GRIB1Op that will subset this one using the specified subsetter. More...
 
def __mul__ (self, grid)
 If the grid is a GRIBGridBase, returns a GRIB1Op that will regrid this GRIB1Op's output to that grid. More...
 
def __add__ (self, other)
 If the argument is a GRIBOp, returns a GRIB1Op that will paste a GRIB1 version of that operations output onto this operation's output. 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

 grib1grid
 The GRIB1 grid (GDS) information if known. More...
 
 grib1grbindex
 The disk location of the GRIB1 grbindex binary index file. More...
 
 grib1index
 Location of the wgrib -s output. More...
 
 grib1file
 GRIB1 file location, synonym for self.location. More...
 
 resultfile
 GRIB1 file location, 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.GRIB1File
 resultfile
 Read-only: the path to the result file, in this case the GRIB1 file. More...
 
 grib1file
 Read-only: the path to the GRIB1 file which is assumed to already exist. More...
 
 grib1index
 Read-only: either None or the wgrib -s index file for the GRIB1 file. More...
 
 grib1grbindex
 Mutable property: either None or the grbindex binary index file for the GRIB1 file. More...
 
 grib1grid
 Read-only: either None or the copygb -g argument data for the GRIB1 file's grid. More...
 
 nscenter
 Read-only: the center latitude of this GRIB1 file in degrees North. More...
 
 ewcenter
 Read-only: the center longitude of this GRIB1 file in degrees East. More...
 
- Properties inherited from hwrf.regrib.GRIBOp
 action
 A read-only property: this objects action function. More...
 

Constructor & Destructor Documentation

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

Creates a new GRIB1Product.

Parameters
dstoreThe dstore is the produtil.datastore.Datastore.
argsPositional arguments, passed to the FileProduct constructor.
kwargsKeyword arguments. The kwargs must specify the file location as a non-empty string.
Note
The GRIB1File is initialized with the various indexes and grid missing (None).

Definition at line 2137 of file regrib.py.

Member Function Documentation

def hwrf.regrib.GRIB1Product.delgrib1grbindex (   self)

Cleares the stored information about the grbindex binary index file location for this GRIB1 product by deleting the grib1grbindex metadata value.

Does NOT delete the grbindex file.

Definition at line 2206 of file regrib.py.

def hwrf.regrib.GRIB1Product.delgrib1grid (   self)

Discards GRIB1 grid information by removing the grib1grid metadata from the datastore.

Definition at line 2187 of file regrib.py.

def hwrf.regrib.GRIB1Product.delgrib1index (   self)

Cleares the stored information about the index location.

Does NOT delete the index file.

Definition at line 2227 of file regrib.py.

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

Delivers the GRIB1 data, and possibly the various index files as well.

If frominfo is supplied, then that file is delivered, and no other action is performed. Otherwise, the file is delivered from self.location to the supplied location, the grib1index is delivered to the same location with an added ".wgrib_s" extension and the grib1grbindex is delivered with a ".grbindex" extension.

Parameters
locationGRIB file delivery location
indexDelivery wgrib -s output location
grbindexWhere to deliver the output of grbindex
frominfoSource information; see above.
keepIf False, source files can be moved instead of copied.
loggera logging.Logger for log messages.

Definition at line 2256 of file regrib.py.

def hwrf.regrib.GRIB1Product.getgrib1file (   self)

Returns the GRIB1 file location from self.location.

Definition at line 2237 of file regrib.py.

def hwrf.regrib.GRIB1Product.getgrib1grbindex (   self)

Returns the output location of grbindex from the grib1grbindex metadata value.

Definition at line 2202 of file regrib.py.

def hwrf.regrib.GRIB1Product.getgrib1grid (   self)

Returns the GRIB1 grid information from the grib1grid metadata in the datastore.

Definition at line 2183 of file regrib.py.

def hwrf.regrib.GRIB1Product.getgrib1index (   self)

Returns the output location of wgrib -s from the grib1index metadata value.

Definition at line 2223 of file regrib.py.

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

Returns True.

This object is its own product, so any kwargs are valid.

Parameters
kwargsKeyword arguments are ignored.

Definition at line 2153 of file regrib.py.

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

Runs self.check and returns the result.

Parameters
argsPositional arguments are ignored.
kwargsKeyword arguments. If frominfo is in kwargs, it is sent as the first positional argument to check.

Definition at line 2158 of file regrib.py.

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

Gets a temporary filename from gribtemp, and copies the GRIB1 file there.

Returns a new GRIB1File object for that file.

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

Definition at line 2167 of file regrib.py.

def hwrf.regrib.GRIB1Product.setgrib1file (   self,
  val 
)

Sets the GRIB1 file location.

Same as setting self.location.

Parameters
valNew file location.

Definition at line 2240 of file regrib.py.

def hwrf.regrib.GRIB1Product.setgrib1grbindex (   self,
  index 
)

Sets the output location of grbindex to the given location, and sets the grib1grbindex metadata value.

Parameters
indexLocation of the grbindex output.

Definition at line 2197 of file regrib.py.

def hwrf.regrib.GRIB1Product.setgrib1grid (   self,
  grid 
)

Sets the GRIB1 grid information; modifies the grib1grid metadata in the datastore.

Parameters
gridthe new grid information

Definition at line 2178 of file regrib.py.

def hwrf.regrib.GRIB1Product.setgrib1index (   self,
  index 
)

Sets the output location of wgrib -s and sets the grib1index metadata value.

Parameters
indexLocation of the wgrib -s output.

Definition at line 2218 of file regrib.py.

def hwrf.regrib.GRIB1Product.undeliver (   self)

Undoes the effect of deliver(), removing the destination index files and GRIB file.

Definition at line 2347 of file regrib.py.

Property Documentation

hwrf.regrib.GRIB1Product.grib1file
static
Initial value:
1 = property(getgrib1file,setgrib1file,None,
2  )

GRIB1 file location, synonym for self.location.

Definition at line 2247 of file regrib.py.

hwrf.regrib.GRIB1Product.grib1grbindex
static
Initial value:
1 = property(getgrib1grbindex,setgrib1grbindex,delgrib1grbindex,
2  )

The disk location of the GRIB1 grbindex binary index file.

Definition at line 2215 of file regrib.py.

hwrf.regrib.GRIB1Product.grib1grid
static
Initial value:
1 = property(getgrib1grid,setgrib1grid,delgrib1grid,
2  )

The GRIB1 grid (GDS) information if known.

Definition at line 2194 of file regrib.py.

hwrf.regrib.GRIB1Product.grib1index
static
Initial value:
1 = property(getgrib1index,setgrib1index,delgrib1index,
2  )

Location of the wgrib -s output.

Definition at line 2234 of file regrib.py.

hwrf.regrib.GRIB1Product.resultfile
static
Initial value:
1 = property(getgrib1file,setgrib1file,None,
2  )

GRIB1 file location, synonym for self.location.

Definition at line 2252 of file regrib.py.


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