ReFRACtor
FullPhysics::OutputHdf Class Reference

This write the output of the Level 2 Full physics. More...

#include <output_hdf.h>

+ Inheritance diagram for FullPhysics::OutputHdf:
+ Collaboration diagram for FullPhysics::OutputHdf:

Public Member Functions

 OutputHdf (const std::string &Fname, int Num_level, int Statevector_size, int Num_aerosol, int Number_band)
 Constructor. This takes the file name to write. More...
 
 OutputHdf (const boost::shared_ptr< HdfFileGenerating > &H, int Num_level, int Statevector_size, int Num_aerosol, int Number_band)
 Constructor. This takes the file to write to. More...
 
virtual ~OutputHdf ()
 
virtual void print (std::ostream &Os) const
 
std::string print_to_string () const
 Print to string. More...
 
template<class S , class T , int D>
void register_data_source (const std::string &Dataset_name, blitz::Array< T, D >(S::*Pmf)() const, const boost::shared_ptr< S > &Src)
 A common way to supply the metadata source is with a shared_ptr to an object, and a pointer to a member function. More...
 
template<class S , class T >
void register_data_source (const std::string &Dataset_name, T(S::*Pmf)() const, const boost::shared_ptr< S > &Src)
 A common way to supply the metadata source is with a shared_ptr to an object, and a pointer to a member function. More...
 
template<class T , int D>
void register_data_source (const std::string &Dataset_name, const blitz::Array< T, D > &Val)
 Handling for when data is constant. More...
 
template<class T >
void register_data_source (const std::string &Dataset_name, const T &Val)
 Handling for when data is constant. More...
 
template<class T >
void register_data_source (const std::string &Dataset_name, boost::function< T > f)
 Most general way to enter a Data source. More...
 
template<class S , class T >
void register_data_source_pad (const std::string &Dataset_name, blitz::Array< T, 1 >(S::*Pmf)() const, const boost::shared_ptr< S > &Src, int Full_size, T Fill_value)
 There are several fields that are generated on the active levels only. More...
 
template<class S , class T >
void register_data_source_pad (const std::string &Dataset_name, blitz::Array< T, 2 >(S::*Pmf)() const, const boost::shared_ptr< S > &Src, int Full_size, T Fill_value)
 
void write ()
 Write out file. More...
 
void write_best_attempt ()
 Write out the file, making a best attempt but ignoring all errors. More...
 

Protected Member Functions

virtual void end_because_of_error ()
 Notify when an error occurred. More...
 
virtual void end_write ()
 Notify when we are done. More...
 
virtual void start_write ()
 Notify derived class that we are starting to write data. More...
 
virtual void write_data (const std::string &Dataset_name, int Val)
 Various write functions that derived classes. More...
 
virtual void write_data (const std::string &Dataset_name, int64_t Val)
 
virtual void write_data (const std::string &Dataset_name, double Val)
 
virtual void write_data (const std::string &Dataset_name, const std::string &Val)
 
virtual void write_data (const std::string &Dataset_name, const char *Val)
 
virtual void write_data (const std::string &Dataset_name, const blitz::Array< int, 1 > &Val)
 
virtual void write_data (const std::string &Dataset_name, const blitz::Array< std::string, 1 > &Val)
 
virtual void write_data (const std::string &Dataset_name, const blitz::Array< const char *, 1 > &Val)
 
virtual void write_data (const std::string &Dataset_name, const blitz::Array< double, 1 > &Val)
 
virtual void write_data (const std::string &Dataset_name, const blitz::Array< int, 2 > &Val)
 
virtual void write_data (const std::string &Dataset_name, const blitz::Array< std::string, 2 > &Val)
 
virtual void write_data (const std::string &Dataset_name, const blitz::Array< const char *, 2 > &Val)
 
virtual void write_data (const std::string &Dataset_name, const blitz::Array< double, 2 > &Val)
 
virtual void write_data (const std::string &Dataset_name, const blitz::Array< int, 3 > &Val)
 
virtual void write_data (const std::string &Dataset_name, const blitz::Array< std::string, 3 > &Val)
 
virtual void write_data (const std::string &Dataset_name, const blitz::Array< const char *, 3 > &Val)
 
virtual void write_data (const std::string &Dataset_name, const blitz::Array< double, 3 > &Val)
 
template<class T >
void write_data_t (const std::string &Dataset_name, T Val)
 
template<class T >
void write_data_t (const std::string &Dataset_name, const blitz::Array< T, 1 > &Val)
 
template<class T >
void write_data_t (const std::string &Dataset_name, const blitz::Array< T, 2 > &Val)
 
template<class T >
void write_data_t (const std::string &Dataset_name, const blitz::Array< T, 3 > &Val)
 

Friends

class OutputTemplate< OutputHdf >
 

Detailed Description

This write the output of the Level 2 Full physics.

This particular implementation writes out a HDF5 file.

Note that we make a few assumptions to simplify the implementation. We could relax any of these constraints, we would just need to modify the implementation.

  1. We assume that there are only a few hardcoded Shapes and Dimensions. The current implementation just uses a fixed hardcoded set. We could create a more general, flexible (but also more complicated) implementation if needed in the future.
  2. We determine the shape metadata of any particular field by looking at the size. If we don't recognize the size, we simply silently leave off the shape metadata information. This allows new fields to be added without needing to necessarily update the shape information (e.g., a new diagnostic field). A consequence of this design decision is that actual mistakes (e.g., wrong number of pressures level reported) won't be caught, and new field may be missing shape information until we change this class. I think this is the right trade, but we may need to reevaluate this at some point in the future.
  3. We assume that the different dimensions that can make the same rank shape are different sizes (e.g., Retrieval_Level_Array and Retrieval_StateVectorElement_Array). It is hard to think of a case where this wouldn't be true, but this assumption is entirely to make the implementation easier. There is no intrinsic reason why we couldn't support these being the same. We check and trigger an error if these are the same, but we can change the code to support this if needed.

An alternative implementation would be to have a table mapping each field to the shape it is. This isn't hugely complicated, but would require us to keep a table of all possible fields. For now, we will do the simpler implementation.

Definition at line 46 of file output_hdf.h.

Constructor & Destructor Documentation

◆ OutputHdf() [1/2]

OutputHdf::OutputHdf ( const std::string &  Fname,
int  Num_level,
int  Statevector_size,
int  Num_aerosol,
int  Number_band 
)

Constructor. This takes the file name to write.

Definition at line 13 of file output_hdf.cc.

◆ OutputHdf() [2/2]

OutputHdf::OutputHdf ( const boost::shared_ptr< HdfFileGenerating > &  H,
int  Num_level,
int  Statevector_size,
int  Num_aerosol,
int  Number_band 
)

Constructor. This takes the file to write to.

Definition at line 27 of file output_hdf.cc.

◆ ~OutputHdf()

virtual FullPhysics::OutputHdf::~OutputHdf ( )
inlinevirtual

Definition at line 52 of file output_hdf.h.

Member Function Documentation

◆ end_because_of_error()

void OutputHdf::end_because_of_error ( )
protectedvirtual

Notify when an error occurred.

Derived classes should clean up any partially generated output.

Reimplemented from FullPhysics::Output.

Definition at line 67 of file output_hdf.cc.

◆ end_write()

virtual void FullPhysics::Output::end_write ( )
inlineprotectedvirtualinherited

Notify when we are done.

Default is to do nothing, but derived classes can override this.

Definition at line 219 of file output.h.

◆ print()

virtual void FullPhysics::OutputHdf::print ( std::ostream &  Os) const
inlinevirtual

Reimplemented from FullPhysics::Output.

Definition at line 53 of file output_hdf.h.

◆ print_to_string()

std::string FullPhysics::Printable< Output >::print_to_string ( ) const
inlineinherited

Print to string.

This is primarily useful for SWIG wrappers to this class, e.g. a to_s method in ruby.

Definition at line 31 of file printable.h.

◆ register_data_source() [1/5]

template<class S , class T , int D>
void FullPhysics::Output::register_data_source ( const std::string &  Dataset_name,
blitz::Array< T, D >(S::*)() const  Pmf,
const boost::shared_ptr< S > &  Src 
)
inlineinherited

A common way to supply the metadata source is with a shared_ptr to an object, and a pointer to a member function.

This supplies a simplified interface to this.

Definition at line 114 of file output.h.

◆ register_data_source() [2/5]

template<class S , class T >
void FullPhysics::Output::register_data_source ( const std::string &  Dataset_name,
T(S::*)() const  Pmf,
const boost::shared_ptr< S > &  Src 
)
inlineinherited

A common way to supply the metadata source is with a shared_ptr to an object, and a pointer to a member function.

This supplies a simplified interface to this.

Definition at line 162 of file output.h.

◆ register_data_source() [3/5]

template<class T , int D>
void FullPhysics::Output::register_data_source ( const std::string &  Dataset_name,
const blitz::Array< T, D > &  Val 
)
inlineinherited

Handling for when data is constant.

Definition at line 175 of file output.h.

◆ register_data_source() [4/5]

template<class T >
void FullPhysics::Output::register_data_source ( const std::string &  Dataset_name,
const T &  Val 
)
inlineinherited

Handling for when data is constant.

Definition at line 188 of file output.h.

◆ register_data_source() [5/5]

template<class T >
void FullPhysics::Output::register_data_source ( const std::string &  Dataset_name,
boost::function< T >  f 
)
inlineinherited

Most general way to enter a Data source.

Definition at line 200 of file output.h.

◆ register_data_source_pad() [1/2]

template<class S , class T >
void FullPhysics::Output::register_data_source_pad ( const std::string &  Dataset_name,
blitz::Array< T, 1 >(S::*)() const  Pmf,
const boost::shared_ptr< S > &  Src,
int  Full_size,
Fill_value 
)
inlineinherited

There are several fields that are generated on the active levels only.

For output, we want to pad this to the full number of levels. This utility routine will pad the given size using the given fill value.

Definition at line 130 of file output.h.

◆ register_data_source_pad() [2/2]

template<class S , class T >
void FullPhysics::Output::register_data_source_pad ( const std::string &  Dataset_name,
blitz::Array< T, 2 >(S::*)() const  Pmf,
const boost::shared_ptr< S > &  Src,
int  Full_size,
Fill_value 
)
inlineinherited

Definition at line 143 of file output.h.

◆ start_write()

void OutputHdf::start_write ( )
protectedvirtual

Notify derived class that we are starting to write data.

Default is to do nothing, but derived classes can override this.

Reimplemented from FullPhysics::Output.

Definition at line 61 of file output_hdf.cc.

◆ write()

void Output::write ( )
inherited

Write out file.

A write is intended to be atomic - either it completely succeeds or the output should be cleaned up and nothing produced. This prevents a file with "missing fields" from being generated.

Definition at line 62 of file output.cc.

◆ write_best_attempt()

void Output::write_best_attempt ( )
inherited

Write out the file, making a best attempt but ignoring all errors.

This may result in a file that is missing fields that had an error when writing or collecting the data. This is intended for use by an error dump, when we want to get whatever we can.

Definition at line 86 of file output.cc.

◆ write_data() [1/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
int  Val 
)
inlineprotectedvirtualinherited

Various write functions that derived classes.

Implements FullPhysics::Output.

Definition at line 281 of file output.h.

◆ write_data() [2/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
int64_t  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 283 of file output.h.

◆ write_data() [3/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
double  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 285 of file output.h.

◆ write_data() [4/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const std::string &  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 287 of file output.h.

◆ write_data() [5/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const char *  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 290 of file output.h.

◆ write_data() [6/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const blitz::Array< int, 1 > &  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 293 of file output.h.

◆ write_data() [7/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const blitz::Array< std::string, 1 > &  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 296 of file output.h.

◆ write_data() [8/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const blitz::Array< const char *, 1 > &  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 299 of file output.h.

◆ write_data() [9/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const blitz::Array< double, 1 > &  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 302 of file output.h.

◆ write_data() [10/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const blitz::Array< int, 2 > &  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 305 of file output.h.

◆ write_data() [11/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const blitz::Array< std::string, 2 > &  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 308 of file output.h.

◆ write_data() [12/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const blitz::Array< const char *, 2 > &  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 311 of file output.h.

◆ write_data() [13/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const blitz::Array< double, 2 > &  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 314 of file output.h.

◆ write_data() [14/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const blitz::Array< int, 3 > &  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 317 of file output.h.

◆ write_data() [15/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const blitz::Array< std::string, 3 > &  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 320 of file output.h.

◆ write_data() [16/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const blitz::Array< const char *, 3 > &  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 323 of file output.h.

◆ write_data() [17/17]

virtual void FullPhysics::OutputTemplate< OutputHdf >::write_data ( const std::string &  Dataset_name,
const blitz::Array< double, 3 > &  Val 
)
inlineprotectedvirtualinherited

Implements FullPhysics::Output.

Definition at line 326 of file output.h.

◆ write_data_t() [1/4]

template<class T >
void OutputHdf::write_data_t ( const std::string &  Dataset_name,
Val 
)
protected

Definition at line 117 of file output_hdf.cc.

◆ write_data_t() [2/4]

template<class T >
void OutputHdf::write_data_t ( const std::string &  Dataset_name,
const blitz::Array< T, 1 > &  Val 
)
protected

Definition at line 128 of file output_hdf.cc.

◆ write_data_t() [3/4]

template<class T >
void OutputHdf::write_data_t ( const std::string &  Dataset_name,
const blitz::Array< T, 2 > &  Val 
)
protected

Definition at line 161 of file output_hdf.cc.

◆ write_data_t() [4/4]

template<class T >
void OutputHdf::write_data_t ( const std::string &  Dataset_name,
const blitz::Array< T, 3 > &  Val 
)
protected

Definition at line 182 of file output_hdf.cc.

Friends And Related Function Documentation

◆ OutputTemplate< OutputHdf >

friend class OutputTemplate< OutputHdf >
friend

Definition at line 65 of file output_hdf.h.


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

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:13