[Met_help] [rt.rap.ucar.edu #86713] History for Combining two masking regions with gen_vx_mask
John Halley Gotway via RT
met_help at ucar.edu
Tue Jul 9 12:07:27 MDT 2019
----------------------------------------------------------------
Initial Request
----------------------------------------------------------------
Hi,
I was wondering if it would be possible to combine two masking regions
using the gen_vx_mask tool? I am trying to combine the PacificNW.nc and
PacificSW.nc Bukovsky regions into one WestCoast.nc region.
Mallory Row provided instructions to pre-process the Bukovsky region netcdf
files using the gen_vx_mask tool so that they will work how they should in
MET, and I was able to do that.
Here is the command I tried to use:
gen_vx_mask PacificNW.nc PacificSW.nc WestCoast.nc -union -name WestCoast
Here is the output from gen_vx_mask:
DEBUG 1: Input File: PacificNW.nc
DEBUG 1: Mask File: PacificSW.nc
DEBUG 2: Parsed Data Grid: LatLon (261 x 121)
ERROR :
") cannot contain embedded whitespace!olyline files consist of a string for
the name followed by pairs of latitude and longitude values. The polyline
name ("�HDF
I think the -union option needs to be invoked somehow but I'm not quite
sure how to go about doing that.
Thanks!
Ben Blake
----------------------------------------------------------------
Complete Ticket History
----------------------------------------------------------------
Subject: Combining two masking regions with gen_vx_mask
From: John Halley Gotway
Time: Wed Aug 22 16:48:02 2018
Ben,
Yep, that's definitely doable. We just need to get the syntax
correct.
If I had those sample files, I could tell you the exact commands. But
I'll
just list a similar example below in the hopes that that it will
suffice.
Let's run gen_vx_mask to generate 2 NetCDF mask files, so we can get
into
the same situation you currently have:
/usr/local/met-7.0/bin/gen_vx_mask nam_2012040900_F012.grib
/usr/local/met-7.0/share/met/poly/NWC.poly NWC_mask.nc -type poly
/usr/local/met-7.0/bin/gen_vx_mask nam_2012040900_F012.grib
/usr/local/met-7.0/share/met/poly/SWC.poly SWC_mask.nc -type poly
So NWC_mask.nc and SWC_mask.nc define the northwest and southwest
coast
masking regions.
Here is a rather long and confusing command that produces their union:
/usr/local/met-7.0/bin/gen_vx_mask NWC_mask.nc SWC_mask.nc
NWC_and_SWC_mask.nc -type data -union -input_field 'name="NWC";
level="(*,*)";' -mask_field 'name="SWC"; level="(*,*)";' -thresh eq1
Here's how this logic works...
- We are doing "data" masking by setting "-type data".
- I've set "NWC_mask.nc" as my "input_file" and I used the following
to
initialize the value at each grid point:
-input_field 'name="NWC"; level="(*,*)";'
- I've set "SWC_mask.nc" as my "mask_file" and I used the following to
specify the field for data masking:
-mask_field 'name="SWC"; level="(*,*)";'
- I defined the threshold for my data masking as "-thresh eq1".
- And I'm taking the "-union" of the "-input_field" values and the
thresholded "-mask_field" values.
That produces the desired output. However here's a less confusing way
of
doing this by running gen_vx_mask twice instead of three times.
(1) Generate the NWC polyline mask:
/usr/local/met-7.0/bin/gen_vx_mask nam_2012040900_F012.grib
/usr/local/met-7.0/share/met/poly/NWC.poly NWC_mask.nc -type poly
(2) Use the NWC polyline mask to initialize the grid points, define
the
SWC polyline mask, and take their union:
/usr/local/met-7.0/bin/gen_vx_mask NWC_mask.nc
/usr/local/met-7.0/share/met/poly/SWC.poly NWC_and_SWC_mask.nc -type
poly
-union
If needed, we could add logic to gen_vx_mask to compute the union
and/or
intersection of a set of existing masks with much less confusing
arguments.
Make sense?
Thanks,
John
On Wed, Aug 22, 2018 at 7:11 AM Benjamin Blake - NOAA Affiliate via RT
<
met_help at ucar.edu> wrote:
>
> Wed Aug 22 07:11:01 2018: Request 86713 was acted upon.
> Transaction: Ticket created by benjamin.blake at noaa.gov
> Queue: met_help
> Subject: Combining two masking regions with gen_vx_mask
> Owner: Nobody
> Requestors: benjamin.blake at noaa.gov
> Status: new
> Ticket <URL:
https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=86713 >
>
>
> Hi,
>
> I was wondering if it would be possible to combine two masking
regions
> using the gen_vx_mask tool? I am trying to combine the PacificNW.nc
and
> PacificSW.nc Bukovsky regions into one WestCoast.nc region.
>
> Mallory Row provided instructions to pre-process the Bukovsky region
netcdf
> files using the gen_vx_mask tool so that they will work how they
should in
> MET, and I was able to do that.
>
> Here is the command I tried to use:
> gen_vx_mask PacificNW.nc PacificSW.nc WestCoast.nc -union -name
WestCoast
>
> Here is the output from gen_vx_mask:
> DEBUG 1: Input File: PacificNW.nc
> DEBUG 1: Mask File: PacificSW.nc
> DEBUG 2: Parsed Data Grid: LatLon (261 x 121)
> ERROR :
> ") cannot contain embedded whitespace!olyline files consist of a
string for
> the name followed by pairs of latitude and longitude values. The
polyline
> name ("�HDF
>
> I think the -union option needs to be invoked somehow but I'm not
quite
> sure how to go about doing that.
>
> Thanks!
> Ben Blake
>
>
------------------------------------------------
Subject: Combining two masking regions with gen_vx_mask
From: Benjamin Blake - NOAA Affiliate
Time: Thu Aug 23 06:29:36 2018
Hi John,
Yes, that makes sense. I thought it would be possible, I just wasn't
sure
what the syntax would be!
Since I had already generated PacificNW.nc and PacificSW.nc using
gen_vx_mask I just had to run the first longer command you provided
which
worked. I did an ncdump -h on the WestCoast.nc file and the variable
is
called data_mask. I then used plot_data_plane WestCoast.nc
WestCoast.ps
'name="data_mask"; level="(*,*)";' to verify it worked and it did (see
attached ps file).
I think eventually having easier logic in gen_vx_mask to compute the
union
or intersection of a set of existing masks would be useful, but it's
certainly not an urgent request.
Thanks for the help!
Ben
On Wed, Aug 22, 2018 at 6:48 PM, John Halley Gotway via RT <
met_help at ucar.edu> wrote:
> Ben,
>
> Yep, that's definitely doable. We just need to get the syntax
correct.
>
> If I had those sample files, I could tell you the exact commands.
But I'll
> just list a similar example below in the hopes that that it will
suffice.
>
> Let's run gen_vx_mask to generate 2 NetCDF mask files, so we can get
into
> the same situation you currently have:
> /usr/local/met-7.0/bin/gen_vx_mask nam_2012040900_F012.grib
> /usr/local/met-7.0/share/met/poly/NWC.poly NWC_mask.nc -type poly
> /usr/local/met-7.0/bin/gen_vx_mask nam_2012040900_F012.grib
> /usr/local/met-7.0/share/met/poly/SWC.poly SWC_mask.nc -type poly
> So NWC_mask.nc and SWC_mask.nc define the northwest and southwest
coast
> masking regions.
>
> Here is a rather long and confusing command that produces their
union:
> /usr/local/met-7.0/bin/gen_vx_mask NWC_mask.nc SWC_mask.nc
> NWC_and_SWC_mask.nc -type data -union -input_field 'name="NWC";
> level="(*,*)";' -mask_field 'name="SWC"; level="(*,*)";' -thresh eq1
>
> Here's how this logic works...
> - We are doing "data" masking by setting "-type data".
> - I've set "NWC_mask.nc" as my "input_file" and I used the following
to
> initialize the value at each grid point:
> -input_field 'name="NWC"; level="(*,*)";'
> - I've set "SWC_mask.nc" as my "mask_file" and I used the following
to
> specify the field for data masking:
> -mask_field 'name="SWC"; level="(*,*)";'
> - I defined the threshold for my data masking as "-thresh eq1".
> - And I'm taking the "-union" of the "-input_field" values and the
> thresholded "-mask_field" values.
>
> That produces the desired output. However here's a less confusing
way of
> doing this by running gen_vx_mask twice instead of three times.
>
> (1) Generate the NWC polyline mask:
> /usr/local/met-7.0/bin/gen_vx_mask nam_2012040900_F012.grib
> /usr/local/met-7.0/share/met/poly/NWC.poly NWC_mask.nc -type poly
> (2) Use the NWC polyline mask to initialize the grid points,
define the
> SWC polyline mask, and take their union:
> /usr/local/met-7.0/bin/gen_vx_mask NWC_mask.nc
> /usr/local/met-7.0/share/met/poly/SWC.poly NWC_and_SWC_mask.nc -type
poly
> -union
>
> If needed, we could add logic to gen_vx_mask to compute the union
and/or
> intersection of a set of existing masks with much less confusing
arguments.
>
> Make sense?
>
> Thanks,
> John
>
>
>
>
> On Wed, Aug 22, 2018 at 7:11 AM Benjamin Blake - NOAA Affiliate via
RT <
> met_help at ucar.edu> wrote:
>
> >
> > Wed Aug 22 07:11:01 2018: Request 86713 was acted upon.
> > Transaction: Ticket created by benjamin.blake at noaa.gov
> > Queue: met_help
> > Subject: Combining two masking regions with gen_vx_mask
> > Owner: Nobody
> > Requestors: benjamin.blake at noaa.gov
> > Status: new
> > Ticket <URL:
https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=86713 >
> >
> >
> > Hi,
> >
> > I was wondering if it would be possible to combine two masking
regions
> > using the gen_vx_mask tool? I am trying to combine the
PacificNW.nc and
> > PacificSW.nc Bukovsky regions into one WestCoast.nc region.
> >
> > Mallory Row provided instructions to pre-process the Bukovsky
region
> netcdf
> > files using the gen_vx_mask tool so that they will work how they
should
> in
> > MET, and I was able to do that.
> >
> > Here is the command I tried to use:
> > gen_vx_mask PacificNW.nc PacificSW.nc WestCoast.nc -union -name
WestCoast
> >
> > Here is the output from gen_vx_mask:
> > DEBUG 1: Input File: PacificNW.nc
> > DEBUG 1: Mask File: PacificSW.nc
> > DEBUG 2: Parsed Data Grid: LatLon (261 x 121)
> > ERROR :
> > ") cannot contain embedded whitespace!olyline files consist of a
string
> for
> > the name followed by pairs of latitude and longitude values. The
polyline
> > name ("�HDF
> >
> > I think the -union option needs to be invoked somehow but I'm not
quite
> > sure how to go about doing that.
> >
> > Thanks!
> > Ben Blake
> >
> >
>
>
------------------------------------------------
Subject: Combining two masking regions with gen_vx_mask
From: John Halley Gotway
Time: Thu Aug 23 11:27:43 2018
Ben,
OK, I'll go ahead and resolve this ticket. FYI, I did add a
development
task for the next MET release to consider making this step easier to
do.
Thanks,
John
On Thu, Aug 23, 2018 at 6:29 AM Benjamin Blake - NOAA Affiliate via RT
<
met_help at ucar.edu> wrote:
>
> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=86713 >
>
> Hi John,
>
> Yes, that makes sense. I thought it would be possible, I just
wasn't sure
> what the syntax would be!
>
> Since I had already generated PacificNW.nc and PacificSW.nc using
> gen_vx_mask I just had to run the first longer command you provided
which
> worked. I did an ncdump -h on the WestCoast.nc file and the
variable is
> called data_mask. I then used plot_data_plane WestCoast.nc
WestCoast.ps
> 'name="data_mask"; level="(*,*)";' to verify it worked and it did
(see
> attached ps file).
>
> I think eventually having easier logic in gen_vx_mask to compute the
union
> or intersection of a set of existing masks would be useful, but it's
> certainly not an urgent request.
>
> Thanks for the help!
>
> Ben
>
> On Wed, Aug 22, 2018 at 6:48 PM, John Halley Gotway via RT <
> met_help at ucar.edu> wrote:
>
> > Ben,
> >
> > Yep, that's definitely doable. We just need to get the syntax
correct.
> >
> > If I had those sample files, I could tell you the exact commands.
But
> I'll
> > just list a similar example below in the hopes that that it will
suffice.
> >
> > Let's run gen_vx_mask to generate 2 NetCDF mask files, so we can
get into
> > the same situation you currently have:
> > /usr/local/met-7.0/bin/gen_vx_mask nam_2012040900_F012.grib
> > /usr/local/met-7.0/share/met/poly/NWC.poly NWC_mask.nc -type poly
> > /usr/local/met-7.0/bin/gen_vx_mask nam_2012040900_F012.grib
> > /usr/local/met-7.0/share/met/poly/SWC.poly SWC_mask.nc -type poly
> > So NWC_mask.nc and SWC_mask.nc define the northwest and southwest
coast
> > masking regions.
> >
> > Here is a rather long and confusing command that produces their
union:
> > /usr/local/met-7.0/bin/gen_vx_mask NWC_mask.nc SWC_mask.nc
> > NWC_and_SWC_mask.nc -type data -union -input_field 'name="NWC";
> > level="(*,*)";' -mask_field 'name="SWC"; level="(*,*)";' -thresh
eq1
> >
> > Here's how this logic works...
> > - We are doing "data" masking by setting "-type data".
> > - I've set "NWC_mask.nc" as my "input_file" and I used the
following to
> > initialize the value at each grid point:
> > -input_field 'name="NWC"; level="(*,*)";'
> > - I've set "SWC_mask.nc" as my "mask_file" and I used the
following to
> > specify the field for data masking:
> > -mask_field 'name="SWC"; level="(*,*)";'
> > - I defined the threshold for my data masking as "-thresh eq1".
> > - And I'm taking the "-union" of the "-input_field" values and the
> > thresholded "-mask_field" values.
> >
> > That produces the desired output. However here's a less confusing
way of
> > doing this by running gen_vx_mask twice instead of three times.
> >
> > (1) Generate the NWC polyline mask:
> > /usr/local/met-7.0/bin/gen_vx_mask nam_2012040900_F012.grib
> > /usr/local/met-7.0/share/met/poly/NWC.poly NWC_mask.nc -type poly
> > (2) Use the NWC polyline mask to initialize the grid points,
define
> the
> > SWC polyline mask, and take their union:
> > /usr/local/met-7.0/bin/gen_vx_mask NWC_mask.nc
> > /usr/local/met-7.0/share/met/poly/SWC.poly NWC_and_SWC_mask.nc
-type poly
> > -union
> >
> > If needed, we could add logic to gen_vx_mask to compute the union
and/or
> > intersection of a set of existing masks with much less confusing
> arguments.
> >
> > Make sense?
> >
> > Thanks,
> > John
> >
> >
> >
> >
> > On Wed, Aug 22, 2018 at 7:11 AM Benjamin Blake - NOAA Affiliate
via RT <
> > met_help at ucar.edu> wrote:
> >
> > >
> > > Wed Aug 22 07:11:01 2018: Request 86713 was acted upon.
> > > Transaction: Ticket created by benjamin.blake at noaa.gov
> > > Queue: met_help
> > > Subject: Combining two masking regions with gen_vx_mask
> > > Owner: Nobody
> > > Requestors: benjamin.blake at noaa.gov
> > > Status: new
> > > Ticket <URL:
https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=86713
> >
> > >
> > >
> > > Hi,
> > >
> > > I was wondering if it would be possible to combine two masking
regions
> > > using the gen_vx_mask tool? I am trying to combine the
PacificNW.nc
> and
> > > PacificSW.nc Bukovsky regions into one WestCoast.nc region.
> > >
> > > Mallory Row provided instructions to pre-process the Bukovsky
region
> > netcdf
> > > files using the gen_vx_mask tool so that they will work how they
should
> > in
> > > MET, and I was able to do that.
> > >
> > > Here is the command I tried to use:
> > > gen_vx_mask PacificNW.nc PacificSW.nc WestCoast.nc -union -name
> WestCoast
> > >
> > > Here is the output from gen_vx_mask:
> > > DEBUG 1: Input File: PacificNW.nc
> > > DEBUG 1: Mask File: PacificSW.nc
> > > DEBUG 2: Parsed Data Grid: LatLon (261 x 121)
> > > ERROR :
> > > ") cannot contain embedded whitespace!olyline files consist of a
string
> > for
> > > the name followed by pairs of latitude and longitude values. The
> polyline
> > > name ("�HDF
> > >
> > > I think the -union option needs to be invoked somehow but I'm
not quite
> > > sure how to go about doing that.
> > >
> > > Thanks!
> > > Ben Blake
> > >
> > >
> >
> >
>
>
------------------------------------------------
More information about the Met_help
mailing list