Skip to content

Commit

Permalink
#1581 Reanmed read_obs_data_strings to read_obs_data_table_lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard Soh committed May 28, 2021
1 parent a070445 commit bf24f7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 87 deletions.
11 changes: 4 additions & 7 deletions met/src/libcode/vx_nc_obs/nc_point_obs_in.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ using namespace std;

#include "nc_point_obs_in.h"

////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -80,14 +77,14 @@ bool MetNcPointObsIn::read_dim_headers() {
//////////////////////////////////////////////////////////////////////

bool MetNcPointObsIn::read_obs_data() {
bool status = read_obs_data_numbers() && read_obs_data_strings();
bool status = read_obs_data_numbers() && read_obs_data_table_lookups();
return status;
}

////////////////////////////////////////////////////////////////////////

bool MetNcPointObsIn::read_obs_data(int buf_size, int start, float *obs_arr_block,
int *obs_qty_idx_block, char *obs_qty_str_block) {
int *obs_qty_idx_block, char *obs_qty_str_block) {
return obs_vars.read_obs_data(buf_size, start, qty_length, obs_arr_block,
obs_qty_idx_block, obs_qty_str_block);
}
Expand All @@ -104,10 +101,10 @@ bool MetNcPointObsIn::read_obs_data_numbers() {

////////////////////////////////////////////////////////////////////////

bool MetNcPointObsIn::read_obs_data_strings() {
bool MetNcPointObsIn::read_obs_data_table_lookups() {
bool status = false;
if( IS_VALID_NC_P(obs_nc) ) {
status = obs_data.read_obs_data_strings(obs_vars);
status = obs_data.read_obs_data_table_lookups(obs_vars);
}
return status;
}
Expand Down
81 changes: 1 addition & 80 deletions met/src/libcode/vx_nc_obs/nc_point_obs_in.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
#include "nc_point_obs.h"


////////////////////////////////////////////////////////////////////////
// struct definition

////////////////////////////////////////////////////////////////////////


Expand All @@ -43,7 +40,7 @@ class MetNcPointObsIn : public MetNcPointObs {
bool read_obs_data(int buf_size, int start, float *obs_arr_block,
int *obs_qty_idx_block, char *obs_qty_str_block);
bool read_obs_data_numbers();
bool read_obs_data_strings();
bool read_obs_data_table_lookups();

// variables

Expand All @@ -54,84 +51,8 @@ class MetNcPointObsIn : public MetNcPointObs {
////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////

class MetNcPointObs2Write : public MetNcPointObs {

protected:
int raw_hdr_cnt;
bool reset_hdr_buffer;

NcDataBuffer data_buffer;
NcObsOutputData out_data;

//MetNcPointObs2Write(const MetNcPointObs2Write &);
//MetNcPointObs2Write & operator=(const MetNcPointObs2Write &);

void init_from_scratch();

public:

MetNcPointObs2Write();
~MetNcPointObs2Write();

bool add_header(const char *hdr_typ, const char *hdr_sid, const time_t hdr_vld,
const float hdr_lat, const float hdr_lon, const float hdr_elv);
bool add_header_prepbufr (const int pb_report_type, const int in_report_type,
const int instrument_type);
bool add_header_strings(const char *hdr_typ, const char *hdr_sid);
bool add_header_vld(const char *hdr_vld);

void create_pb_hdrs(int pb_hdr_count);

int get_buf_size();
void get_dim_counts(int *obs_cnt, int *hdr_cnt);
int get_hdr_index();
int get_obs_index();
NcObsOutputData *get_output_data();
NetcdfObsVars *get_obs_vars();

void init_buffer();
void init_obs_vars(bool using_var_id, int deflate_level, bool attr_agl=false);
bool init_netcdf(int obs_count, int hdr_count, string program_name);

void reset_header_buffer(int buf_size, bool reset_all);
void set_nc_out_data(vector<Observation> observations,
SummaryObs *summary_obs, TimeSummaryInfo summary_info,
int processed_hdr_cnt=0);

void write_arr_headers();
void write_buf_headers ();
void write_header (const char *hdr_typ, const char *hdr_sid, const time_t hdr_vld,
const float hdr_lat, const float hdr_lon, const float hdr_elv);
void write_observation();
void write_observation(const float obs_arr[OBS_ARRAY_LEN], const char *obs_qty);
void write_obs_data();
int write_obs_data(const vector< Observation > observations,
const bool do_header = true);
bool write_to_netcdf(StringArray obs_names, StringArray obs_units,
StringArray obs_descs);

// variables

// data

}; // MetNcPointObs2Write


////////////////////////////////////////////////////////////////////////

inline int MetNcPointObs2Write::get_hdr_index() { return data_buffer.cur_hdr_idx; }
inline int MetNcPointObs2Write::get_obs_index() { return data_buffer.obs_data_idx; }
inline NcObsOutputData *MetNcPointObs2Write::get_output_data() { return &out_data; }
inline NetcdfObsVars *MetNcPointObs2Write::get_obs_vars() { return &obs_vars; }

////////////////////////////////////////////////////////////////////////


#endif /* __NC_POINT_OBS_IN_H__ */


////////////////////////////////////////////////////////////////////////


0 comments on commit bf24f7a

Please sign in to comment.