ReFRACtor
absco_hdf.h
Go to the documentation of this file.
1 #ifndef ABSCO_HDF_H
2 #define ABSCO_HDF_H
3 #include "absco.h"
4 #include "hdf_file.h"
5 #include "spectral_bound.h"
6 #include <blitz/array.h>
7 #include <vector>
8 
9 
10 namespace FullPhysics {
11 /****************************************************************/
20 class AbscoHdf: public Absco {
21 public:
22  AbscoHdf(const std::string& Fname, double Table_scale = 1.0,
23  int Cache_nline = 5000);
24  AbscoHdf(const std::string& Fname,
25  const SpectralBound& Spectral_bound,
26  const std::vector<double>& Table_scale,
27  int Cache_nline = 5000);
28  void load_file(const std::string& Fname);
29  void load_file(const std::string& Fname, double Table_scale,
30  int Cache_nline = 5000);
31  void load_file(const std::string& Fname,
32  const SpectralBound& Spectral_bound,
33  const std::vector<double>& Table_scale,
34  int Cache_nline = 5000);
35  virtual ~AbscoHdf() {}
36  virtual std::string broadener_name() const { return bname; }
37  virtual blitz::Array<double, 1> broadener_vmr_grid() const
38  { return bvmr; }
39  virtual const std::pair<double*, double*> wn_extent(double Wn_in) const;
40  virtual double table_scale(double wn) const;
41  virtual blitz::Array<double, 1> pressure_grid() const {return pgrid;}
42  virtual blitz::Array<double, 2> temperature_grid() const {return tgrid;}
43  virtual bool have_data(double wn) const;
44  virtual bool is_float() const { return is_float_;}
45  virtual std::string file_name() const { return hfile->file_name(); }
46  virtual void print(std::ostream& Os) const;
47 protected:
48  virtual blitz::Array<double, 3> read_double(double wn) const;
49  virtual blitz::Array<float, 3> read_float(double wn) const;
50 private:
51  bool is_float_;
52  int cache_nline;
53  blitz::Array<double, 1> bvmr;
55  mutable int cache_double_lbound;
56  mutable int cache_double_ubound;
57  mutable int cache_float_lbound;
58  mutable int cache_float_ubound;
59  template<class T> void bound_set(int lbound, int sz) const;
60  mutable blitz::Array<double, 4> read_cache_double;
61  mutable blitz::Array<float, 4> read_cache_float;
62  template<class T> blitz::Array<T, 4>& read_cache() const;
63  template<class T> void swap(int i) const;
64  int wn_index(double Wn_in) const;
65  std::string field_name;
66  std::string bname;
67  blitz::Array<double, 1> pgrid;
68  blitz::Array<double, 2> tgrid;
69  blitz::Array<double, 1> wngrid;
70  SpectralBound sb;
71  std::vector<double> table_scale_;
72  blitz::Array<double, 2> extent_range;
73  blitz::Array<int, 2> extent_index;
74  // This just points to front of wn. We store this here so
75  // don't need to keep calculating this.
76  double *wnfront;
77 };
78 
79 template<> inline blitz::Array<double, 4>& AbscoHdf::read_cache<double>() const
80 { return read_cache_double; }
81 
82 template<> inline blitz::Array<float, 4>& AbscoHdf::read_cache<float>() const
83 { return read_cache_float; }
84 
85 template<> inline void AbscoHdf::bound_set<double>(int lbound, int sz) const
86 {
87  cache_double_lbound = lbound;
88  cache_double_ubound = lbound + sz;
89 }
90 
91 template<> inline void AbscoHdf::bound_set<float>(int lbound, int sz) const
92 {
93  cache_float_lbound = lbound;
94  cache_float_ubound = lbound + sz;
95 }
96 
97 }
98 #endif
This class is used to read the absco tables.
Definition: absco.h:56
virtual blitz::Array< double, 2 > temperature_grid() const
Return the temperature grid for this Absco file.
Definition: absco_hdf.h:42
virtual blitz::Array< double, 1 > pressure_grid() const
Return the pressure grid used for this Absco file.
Definition: absco_hdf.h:41
virtual std::string file_name() const
Definition: absco_hdf.h:45
AbscoHdf(const std::string &Fname, double Table_scale=1.0, int Cache_nline=5000)
Read the given Absco file.
Definition: absco_hdf.cc:27
virtual blitz::Array< float, 3 > read_float(double wn) const
Definition: absco_hdf.cc:272
virtual ~AbscoHdf()
Definition: absco_hdf.h:35
virtual blitz::Array< double, 1 > broadener_vmr_grid() const
Return the broadener VMR grid used for this Absco file.
Definition: absco_hdf.h:37
This gives the upper and lower bounds of the SpectralWindow.
virtual const std::pair< double *, double * > wn_extent(double Wn_in) const
Definition: absco_hdf.cc:169
virtual bool is_float() const
Note some of the Absco data files used float, and some use doubles.
Definition: absco_hdf.h:44
virtual blitz::Array< double, 3 > read_double(double wn) const
Return either a blitz::Array<double, 3> or blitz::Array<float, 3>, depending on the type of the under...
Definition: absco_hdf.cc:261
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
virtual void print(std::ostream &Os) const
Definition: absco_hdf.cc:317
virtual double table_scale(double wn) const
Scale to apply to underlying ABSCO data to get the absorption_cross_section.
Definition: absco_hdf.cc:205
virtual std::string broadener_name() const
For some tables, we might have a broadener (e.g., "h2o").
Definition: absco_hdf.h:36
This class is used to read the absco tables.
Definition: absco_hdf.h:20
void load_file(const std::string &Fname)
Load file, using the same table scaling as we already have.
Definition: absco_hdf.cc:55
virtual bool have_data(double wn) const
Return true if we have data for the given wave number.
Definition: absco_hdf.cc:217

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