Skip to content

Commit 891cc2c

Browse files
committed
Add support for getting CH4 and CO a priori from the profile file.
1 parent 6a5c7eb commit 891cc2c

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

input/common/config/config_common.lua

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,11 +950,11 @@ function ConfigCommon:reference_co2_apriori_met_apriori()
950950
end
951951

952952
------------------------------------------------------------
953-
--- Get co2 apriori for the profile file
953+
--- Get co2 apriori from the profile file
954954
------------------------------------------------------------
955955

956956
function ConfigCommon:co2_profile_file_apriori()
957-
local t = CO2ProfilePrior(self.config.met, self.config:h_co2_profile())
957+
local t = CO2ProfilePrior(self.config.met, self.config:h_co2_profile(), "CO2Prior/co2_prior_profile_cpr")
958958
return t:apriori_vmr(self.config.pressure)
959959
end
960960

@@ -1000,6 +1000,15 @@ function ConfigCommon:reference_ch4_apriori_met_apriori()
10001000
return t:apriori_vmr(self.config.pressure)
10011001
end
10021002

1003+
------------------------------------------------------------
1004+
--- Get ch4 apriori from the profile file
1005+
------------------------------------------------------------
1006+
1007+
function ConfigCommon:ch4_profile_file_apriori()
1008+
local t = CO2ProfilePrior(self.config.met, self.config:h_co2_profile(), "CH4Prior/ch4_prior_profile_cpr")
1009+
return t:apriori_vmr(self.config.pressure)
1010+
end
1011+
10031012
------------------------------------------------------------
10041013
--- Load the CO VMR object
10051014
------------------------------------------------------------
@@ -1021,6 +1030,15 @@ function ConfigCommon:reference_co_apriori_met_apriori()
10211030
return t:apriori_vmr(self.config.pressure)
10221031
end
10231032

1033+
------------------------------------------------------------
1034+
--- Get co apriori from the profile file
1035+
------------------------------------------------------------
1036+
1037+
function ConfigCommon:co_profile_file_apriori()
1038+
local t = CO2ProfilePrior(self.config.met, self.config:h_co2_profile(), "COPrior/co_prior_profile_cpr")
1039+
return t:apriori_vmr(self.config.pressure)
1040+
end
1041+
10241042
------------------------------------------------------------
10251043
-- Short cut for making a flag array. This takes a size, creates
10261044
-- a bool array of that size and sets everything in the passed

lib/Implementation/co2_profile_prior.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using namespace blitz;
88
#include "register_lua.h"
99
REGISTER_LUA_CLASS(CO2ProfilePrior)
1010
.def(luabind::constructor<const OcoMetFile&,
11-
const HdfFile&>())
11+
const HdfFile&, const std::string&>())
1212
.def("apriori_vmr", &CO2ProfilePrior::apriori_vmr)
1313
REGISTER_LUA_END()
1414
#endif
@@ -19,11 +19,11 @@ REGISTER_LUA_END()
1919

2020
CO2ProfilePrior::CO2ProfilePrior
2121
(const OcoMetFile& Met_file,
22-
const HdfFile& Profile_file)
22+
const HdfFile& Profile_file,
23+
const std::string& field)
2324
: model_press(Met_file.pressure_levels())
2425
{
2526
boost::shared_ptr<HdfSoundingId> hsid = Met_file.sounding_id();
26-
std::string field = "CO2Prior/co2_prior_profile_cpr";
2727
TinyVector<int, 3> sz = Profile_file.read_shape<3>(field);
2828
Array<double, 3> traw = Profile_file.read_field<double, 3>
2929
(field,

lib/Implementation/co2_profile_prior.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ namespace FullPhysics {
1212
class CO2ProfilePrior: public Printable<CO2ProfilePrior> {
1313
public:
1414
CO2ProfilePrior(const OcoMetFile& Met_file,
15-
const HdfFile& Profile_file);
15+
const HdfFile& Profile_file,
16+
const std::string& field);
1617
virtual ~CO2ProfilePrior() {}
1718
blitz::Array<double, 1> apriori_vmr(const Pressure& pressure) const;
1819
virtual void print(std::ostream& Os) const { Os << "CO2ProfilePrior";}

lib/Implementation/co2_profile_prior.i

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ namespace FullPhysics {
1414
class CO2ProfilePrior: public GenericObject {
1515
public:
1616
CO2ProfilePrior(const OcoMetFile& Met_file,
17-
const HdfFile& Profile_file) {}
17+
const HdfFile& Profile_file,
18+
const std::string& field) {}
1819
blitz::Array<double, 1> apriori_vmr(const Pressure& pressure) const;
1920
};
2021
}

0 commit comments

Comments
 (0)