Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard Soh committed Apr 16, 2021
1 parent cd849ba commit 14e0378
Showing 1 changed file with 44 additions and 45 deletions.
89 changes: 44 additions & 45 deletions met/src/libcode/vx_nc_obs/nc_obs_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

using namespace netCDF;

#include "nc_summary.h"

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

Expand All @@ -27,8 +28,6 @@ static const char empty_name[] = "";
////////////////////////////////////////////////////////////////////////
// struct definition

struct NcHeaderData;

struct NcDataBuffer {
int processed_count;
int obs_count;
Expand Down Expand Up @@ -73,8 +72,46 @@ struct NcDataBuffer {
float obs_lvl_buf[OBS_BUFFER_SIZE];
float obs_hgt_buf[OBS_BUFFER_SIZE];
float obs_val_buf[OBS_BUFFER_SIZE];

NcDataBuffer();
void reset_counters();
};

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

struct NcHeaderData {
bool valid_point_obs;
int typ_len;
int sid_len;
int vld_len;
int strl_len;
int strll_len;
int min_vld_time;
int max_vld_time;
int hdr_count;
int hdr_type_count;

StringArray typ_array;
StringArray sid_array;
StringArray vld_array;
IntArray vld_num_array;
IntArray typ_idx_array;
IntArray sid_idx_array;
IntArray vld_idx_array;
NumArray lat_array;
NumArray lon_array;
NumArray elv_array;
IntArray prpt_typ_array;
IntArray irpt_typ_array;
IntArray inst_typ_array;

NcHeaderData();
void clear();
void reset_counters();
};

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

struct NetcdfObsVars {
bool attr_agl ;
bool attr_pb2nc ;
Expand All @@ -83,8 +120,6 @@ struct NetcdfObsVars {
int obs_cnt ; // obs. array count (fixed dimension if obs_cnt > 0)
int raw_hdr_cnt ; // raw data (PrepBufr) header array count
int deflate_level;
//NcDataBuffer data_buffer;
//NcHeaderData *hdr_data;

NcDim strl_dim ; // header string dimension (16 bytes)
NcDim strl2_dim ; // header string dimension (40 bytes)
Expand Down Expand Up @@ -139,10 +174,6 @@ struct NetcdfObsVars {

int get_hdr_index();
int get_obs_index();
//NcHeaderData *get_header_data();
//void set_header_data();

// void init_data_buffer();

void read_dims_vars(NcFile *f_in);
NcHeaderData read_header_data();
Expand All @@ -155,46 +186,11 @@ struct NetcdfObsVars {
void write_obs_var_names(StringArray &obs_names);
void write_obs_var_units(StringArray &units);
void write_obs_var_descriptions(StringArray &descriptions);
// void write_observation();
// void write_observation(const float obs_arr[OBS_ARRAY_LEN], const char *obs_qty);
// int write_observations(const vector< Observation > observations,
// NcDataBuffer &data_buffer, const bool do_header = true);
// int write_observations(const vector< Observation > observations,
// NcDataBuffer &data_buffer, const bool do_header = true);
void write_table_vars(NcHeaderData &hdr_data, NcDataBuffer &data_buffer);

}; // NetcdfObsVars

struct NcHeaderData {
bool valid_point_obs;
int typ_len;
int sid_len;
int vld_len;
int strl_len;
int strll_len;
int min_vld_time;
int max_vld_time;
int hdr_count;
int hdr_type_count;

StringArray typ_array;
StringArray sid_array;
StringArray vld_array;
IntArray vld_num_array;
IntArray typ_idx_array;
IntArray sid_idx_array;
IntArray vld_idx_array;
NumArray lat_array;
NumArray lon_array;
NumArray elv_array;
IntArray prpt_typ_array;
IntArray irpt_typ_array;
IntArray inst_typ_array;

NcHeaderData();
void clear();
void reset_counters();
};
////////////////////////////////////////////////////////////////////////

struct NcPointObsData {
int obs_cnt;
Expand All @@ -220,12 +216,13 @@ struct NcPointObsData {
};

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

// extern variables

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

extern bool add_nc_header_prepbufr (const int pb_report_type,
const int in_report_type, const int instrument_type);
const int in_report_type, const int instrument_type);

extern long count_nc_headers (vector< Observation > &observations);

Expand All @@ -238,6 +235,8 @@ extern bool is_using_var_id (NcFile * nc_file);
extern void reset_header_buffer(int buf_size, bool reset_all=false);
extern void set_header_buffer(int buf_size, bool reset_all=false);

extern string seconds_to_time_string(const int secs);

extern void write_nc_obs_buffer (const int buf_size);
extern int write_nc_string_array (NcVar *ncVar, StringArray &strArray,
const int str_len);
Expand Down

0 comments on commit 14e0378

Please sign in to comment.