Skip to content

Commit

Permalink
Revert "Feature 1815 level value" (#2201)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe authored Jun 30, 2022
1 parent 14a059e commit 2649886
Show file tree
Hide file tree
Showing 28 changed files with 757 additions and 1,012 deletions.
12 changes: 3 additions & 9 deletions docs/Users_Guide/appendixA.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,9 @@ Q. How do I choose a time slice in a NetCDF file?

A.
When processing NetCDF files, the level information needs to be
specified to tell MET which 2D slice of data to use. The index is selected from
a value when it starts with "@" for vertical level (pressure or height)
and time. The actual time, @YYYYMMDD_HHMM, is allowed instead of selecting
the time index.
specified to tell MET which 2D slice of data to use. There is
currently no way to explicitly define which time slice to use
other than selecting the time index.

Let's use plot_data_plane as an example:

Expand All @@ -161,11 +160,6 @@ Let's use plot_data_plane as an example:
obs.ps \
'name="APCP"; level="(5,*,*)";'
plot_data_plane \
gtg_obs_forecast.20130730.i00.f00.nc \
altitude_20000.ps \
'name = "edr"; level = "(@20130730_0000,@20000,*,*)";'
Assuming that the first array is the time, this will select the 6-th
time slice of the APCP data and plot it since these indices are 0-based.

Expand Down
14 changes: 1 addition & 13 deletions docs/Users_Guide/config_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -991,8 +991,7 @@ File-format specific settings for the "field" entry:

* (i,...,j,*,*) for a single field, where i,...,j specifies fixed
dimension values and *,* specifies the two dimensions for the
gridded field. @ specifies the vertical level value or time value
instead of offset, (i,...,@NNN,*,*). For example:
gridded field. For example:

.. code-block:: none
Expand All @@ -1007,17 +1006,6 @@ File-format specific settings for the "field" entry:
}
];
field = [
{
name = "QVAPOR";
level = "(@20220601_1200,@850,*,*)";
},
{
name = "TMP_P850_ENS_MEAN";
level = [ "(*,*)" ];
}
];
* Python (using PYTHON_NUMPY or PYTHON_XARRAY):

* The Python interface for MET is described in Appendix F of the MET
Expand Down
16 changes: 1 addition & 15 deletions internal/test_unit/xml/unit_plot_data_plane.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,20 +273,6 @@
</output>
</test>

<test name="plot_data_plane_NCCF_latlon_by_value">
<exec>&MET_BIN;/plot_data_plane</exec>
<param> \
&DATA_DIR_MODEL;/nccf/gtg/latlon/gtg_obs_forecast.20130730.i00.f00.nc \
&OUTPUT_DIR;/plot_data_plane/gtg_obs_forecast.20130730.i00.f00.NCCF_latlon_20000.ps \
'name = "edr"; level = "(0,@20000,*,*)";' \
-title "NCCF Latitude/Longitude Level 0" \
-v 1
</param>
<output>
<ps>&OUTPUT_DIR;/plot_data_plane/gtg_obs_forecast.20130730.i00.f00.NCCF_latlon_20000.ps</ps>
</output>
</test>

<test name="plot_data_plane_NCCF_north_to_south">
<exec>&MET_BIN;/plot_data_plane</exec>
<param> \
Expand Down Expand Up @@ -417,7 +403,7 @@
<param> \
&DATA_DIR_MODEL;/easm/pr_day_MPI-ESM-MR_rcp85_r1i1p1_20060101-20091231.nc \
&OUTPUT_DIR;/plot_data_plane/EaSM_CMIP5_pr_day_MPI-ESM-MR_rcp85_r1i1p1_20060101_12_time.ps \
'name="pr"; level="(@20060102_000000,*,*)";' \
'name="pr"; level="(20060102_000000,*,*)";' \
-v 4
</param>
<output>
Expand Down
1 change: 0 additions & 1 deletion src/basic/vx_util/util_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ static const double const_gop = 9.80616; // from The Ceaseless Wind
static const double const_rd = 287.0; // kg/k dry gas constant

static const int vx_data2d_star = -12345;
static const int vx_data2d_dim_by_value = -123456; // apply the value instead of offset for slicing

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

Expand Down
22 changes: 18 additions & 4 deletions src/libcode/vx_data2d/level_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ void LevelInfo::init_from_scratch() {

clear();

return;
}

///////////////////////////////////////////////////////////////////////////////
Expand All @@ -87,8 +88,9 @@ void LevelInfo::assign(const LevelInfo &l) {
Upper = l.upper();
Lower = l.lower();
Increment = l.increment();
Is_offset = l.is_offset();
time_as_offset = l.is_time_as_offset();

return;
}

///////////////////////////////////////////////////////////////////////////////
Expand All @@ -104,8 +106,9 @@ void LevelInfo::clear() {
Upper = 0.0;
Lower = 0.0;
Increment = 0.0;
Is_offset = true;
time_as_offset = true;

return;
}

///////////////////////////////////////////////////////////////////////////////
Expand All @@ -122,67 +125,78 @@ void LevelInfo::dump(ostream &out) const {
<< " Upper = " << Upper << "\n"
<< " Increment = " << Increment << "\n";

return;
}

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

void LevelInfo::set_type(LevelType lt) {
Type = lt;
return;
}

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

void LevelInfo::set_type_num(int i) {
TypeNum = i;
return;
}

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

void LevelInfo::set_req_name(const char *str) {
ReqName = str;
return;
}

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

void LevelInfo::set_name(const char *str) {
Name = str;
return;
}

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

void LevelInfo::set_units(const char *str) {
Units = str;
return;
}

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

void LevelInfo::set_upper(double u) {
Upper = u;
return;
}

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

void LevelInfo::set_lower(double l) {
Lower = l;
return;
}

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

void LevelInfo::set_range(double l, double u) {
Lower = l;
Upper = u;
return;
}

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

void LevelInfo::set_increment(double i) {
Increment = i;
return;
}

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

void LevelInfo::set_is_offset(bool b) {
Is_offset = b;
void LevelInfo::set_time_as_offset(bool b) {
time_as_offset = b;
return;
}

///////////////////////////////////////////////////////////////////////////////
8 changes: 4 additions & 4 deletions src/libcode/vx_data2d/level_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class LevelInfo
double Upper; // Upper level limit
double Lower; // Lower level limit
double Increment; // Increment (time: seconds, 0 for no increment)
bool Is_offset; // default: true, false: the value instead
bool time_as_offset;// default: true, false: the (time) value instead
// of the offset at Lower and Upper

void init_from_scratch();
Expand Down Expand Up @@ -77,7 +77,7 @@ class LevelInfo
double upper() const;
double lower() const;
double increment() const;
bool is_offset() const;
bool is_time_as_offset()const;

//
// set stuff
Expand All @@ -92,7 +92,7 @@ class LevelInfo
void set_lower(double l);
void set_range(double l, double u);
void set_increment(double i);
void set_is_offset(bool b);
void set_time_as_offset(bool b);

};

Expand All @@ -106,7 +106,7 @@ inline ConcatString LevelInfo::units() const { return(Units); }
inline double LevelInfo::upper() const { return(Upper); }
inline double LevelInfo::lower() const { return(Lower); }
inline double LevelInfo::increment()const { return(Increment);}
inline bool LevelInfo::is_offset()const { return(Is_offset);}
inline bool LevelInfo::is_time_as_offset()const { return(time_as_offset);}

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

Expand Down
16 changes: 11 additions & 5 deletions src/libcode/vx_data2d_nc_met/met_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ using namespace std;
static const char x_dim_name [] = "lon";
static const char y_dim_name [] = "lat";

static const string valid_time_att_name = "valid_time";
static const string init_time_att_name = "init_time";
static const string valid_time_ut_att_name = "valid_time_ut";
static const string init_time_ut_att_name = "init_time_ut";
static const string accum_time_att_name = "accum_time_sec";

static const int max_met_args = 30;

////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -248,11 +254,11 @@ for (j=0; j<Ndims; ++j) {
//
// parse the variable attributes
//
get_att_name ( Var[j], Var[j].name_att );
get_var_long_name( Var[j].var, Var[j].long_name_att );
get_att_level ( Var[j], Var[j].level_att );
get_var_units ( Var[j].var, Var[j].units_att );
get_att_accum_time( Var[j], Var[j].AccumTime );
get_att_str( Var[j], name_att_name, Var[j].name_att );
get_att_str( Var[j], long_name_att_name, Var[j].long_name_att );
get_att_str( Var[j], level_att_name, Var[j].level_att );
get_att_str( Var[j], units_att_name, Var[j].units_att );
get_att_int( Var[j], accum_time_att_name, Var[j].AccumTime );

get_att_unixtime( Var[j], init_time_ut_att_name, ill);
get_att_unixtime( Var[j], valid_time_ut_att_name, vll);
Expand Down
15 changes: 2 additions & 13 deletions src/libcode/vx_data2d_nc_pinterp/data2d_nc_pinterp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,9 @@ bool MetNcPinterpDataFile::data_plane(VarInfo &vinfo, DataPlane &plane) {
plane.clear();

// Read the data
PinterpNc->get_nc_var_info(vinfo_nc->req_name().c_str(), info);
LongArray dimension = vinfo_nc->dimension();
int dim_count = dimension.n_elements();
for (int k=0; k<dim_count; k++) {
if (dimension[k] == vx_data2d_dim_by_value) {
dimension[k] = get_index_for_dim(PinterpNc->Var,
GET_NC_NAME(get_nc_dim(info->var, k)),
vinfo_nc->dim_value(k), PinterpNc->Nvars,
(k == info->t_slot));
}
}

status = PinterpNc->data(vinfo_nc->req_name().c_str(),
dimension, plane, pressure, info);
vinfo_nc->dimension(),
plane, pressure, info);

// Check that the times match those requested
if(status) {
Expand Down
Loading

0 comments on commit 2649886

Please sign in to comment.