[Met_help] [rt.rap.ucar.edu #42754] History for copy GRIBdata for a smaller region (ggrib, copygb)

RAL HelpDesk {for John Halley Gotway} met_help at ucar.edu
Wed Feb 23 14:44:08 MST 2011


----------------------------------------------------------------
  Initial Request
----------------------------------------------------------------

Hi,
    I like to extract data from a grib file for a smaller region (e.g., 
CONUS) on its native grid; I do not want to do  any interpolation. I 
understood that copygb and ggrib will do the job but unable to figure out.
1. copygb options,  "-B" and "-g" (grid= -1 yields output grid as input 
grid), might do the job but did not find any guidelines to pass lat and 
long information of a region that I want to extract the data
2. ggrib should do the job but when I executed the following messaged 
displayed.

$ ggrib test.grib conus_test.grib -130 25 -50 55
ERROR: Grid #   1 not in geographic coordinates (lon,lat), exiting

Any help is greatly appreciated.
Thanks much,
Satish




----------------------------------------------------------------
  Complete Ticket History
----------------------------------------------------------------

Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller region (ggrib,copygb)
From: John Halley Gotway
Time: Tue Dec 14 09:18:35 2010

Satish,

We are not able to offer direct support to users who have not yet
registered on the MET website.  We do this to ensure that we remain in
compliance with the international export laws of the United
States.

To fill out the free registration, please go here:
   http://www.dtcenter.org/met/users/downloads/index.php

Enter your email address in the box and hit enter.  That'll take you
to the registration page.

Please write us back to let us know when you've registered.

Thanks,
John Halley Gotway
met_help at ucar.edu

On 12/14/2010 08:26 AM, RAL HelpDesk {for Satish Regonda} wrote:
>
> Tue Dec 14 08:26:56 2010: Request 42754 was acted upon.
> Transaction: Ticket created by Satish.Regonda at noaa.gov
>        Queue: met_help
>      Subject: copy GRIBdata for a smaller region (ggrib,copygb)
>        Owner: Nobody
>   Requestors: Satish.Regonda at noaa.gov
>       Status: new
>  Ticket <URL:
https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
>
>
> Hi,
>     I like to extract data from a grib file for a smaller region
(e.g.,
> CONUS) on its native grid; I do not want to do  any interpolation. I
> understood that copygb and ggrib will do the job but unable to
figure out.
> 1. copygb options,  "-B" and "-g" (grid= -1 yields output grid as
input
> grid), might do the job but did not find any guidelines to pass lat
and
> long information of a region that I want to extract the data
> 2. ggrib should do the job but when I executed the following
messaged
> displayed.
>
> $ ggrib test.grib conus_test.grib -130 25 -50 55
> ERROR: Grid #   1 not in geographic coordinates (lon,lat), exiting
>
> Any help is greatly appreciated.
> Thanks much,
> Satish
>
>

------------------------------------------------
Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller region (ggrib,copygb)
From: Satish Regonda
Time: Tue Dec 14 09:23:29 2010


Dear John Halley Gotway,
   I did register. Kindly let me know if you need any additional
information.
thanks much,
Satish

----- Original Message -----
From: RAL HelpDesk {for John Halley Gotway} <met_help at ucar.edu>
Date: Tuesday, December 14, 2010 11:18 am
Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
region
(ggrib,copygb)

> Satish,
>
> We are not able to offer direct support to users who have not yet
> registered on the MET website.  We do this to ensure that we remain
> in compliance with the international export laws of the United
> States.
>
> To fill out the free registration, please go here:
>   http://www.dtcenter.org/met/users/downloads/index.php
>
> Enter your email address in the box and hit enter.  That'll take
> you to the registration page.
>
> Please write us back to let us know when you've registered.
>
> Thanks,
> John Halley Gotway
> met_help at ucar.edu
>
> On 12/14/2010 08:26 AM, RAL HelpDesk {for Satish Regonda} wrote:
> >
> > Tue Dec 14 08:26:56 2010: Request 42754 was acted upon.
> > Transaction: Ticket created by Satish.Regonda at noaa.gov
> >        Queue: met_help
> >      Subject: copy GRIBdata for a smaller region (ggrib,copygb)
> >        Owner: Nobody
> >   Requestors: Satish.Regonda at noaa.gov
> >       Status: new
> >  Ticket <URL:
> https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
> >
> >
> > Hi,
> >     I like to extract data from a grib file for a smaller region
> (e.g.,
> > CONUS) on its native grid; I do not want to do  any
> interpolation. I
> > understood that copygb and ggrib will do the job but unable to
> figure out.
> > 1. copygb options,  "-B" and "-g" (grid= -1 yields output grid as
> input
> > grid), might do the job but did not find any guidelines to pass
> lat and
> > long information of a region that I want to extract the data
> > 2. ggrib should do the job but when I executed the following
> messaged
> > displayed.
> >
> > $ ggrib test.grib conus_test.grib -130 25 -50 55
> > ERROR: Grid #   1 not in geographic coordinates (lon,lat), exiting
> >
> > Any help is greatly appreciated.
> > Thanks much,
> > Satish
> >
> >
>
>

------------------------------------------------
Subject: copy GRIBdata for a smaller region (ggrib,copygb)
From: John Halley Gotway
Time: Tue Dec 14 10:06:25 2010

Satish,

First, I'm not familiar with ggrib - we only really use copygb here.

So I understand that you'd like to create a subset of a GRIB record
without actually interpolating it.  The short answer is that I do not
know how to do that directly.

I believe that if you'd like to only look at a subset of the data that
would by definition change how the grid is defined.  For example, if
you want to reduce the number of grid point you're look at -
say from 360x180 down to 100x100 - that would change the grid
definition.  And you'd need to regrid using the "-g" option in copygb
to do that regridding.  However, if you just want to "mask" out a
subset of the data in your input file you do have some options.

So here are some things you may want to consider trying:

(1) First, you could create a user-defined grid to regrid your data
using the "-g" option.  We've included some examples in the MET online
tutorial describing how to do this:
   http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/index.php
Just click on the forward arrow to advance through the pages.  If you
choose a grid who's grid points are very similar to the input grid,
the effect of interpolating will be very minimal.  For a
lat/lon grid, you should be able to define an exact subset.  For other
projections, that'd be more difficult.

(2) If you're using this GRIB data as input to the MET tools, you
could just leave the data on it's native domain.  And then in MET, you
can using the "mask_grid" and "mask_poly" options in the
configuration files to define the subsets of the grid over which you'd
like to perform the verification.

(3) You can use copygb to "mask out" subsets of your domain in which
your interested.  Please note, this will NOT regrid the data, just
mask it out on it's native grid.  Here are some examples:
   # Retrieve a sample NAM file
   wget http://nomads.ncdc.noaa.gov/data/meso-eta-
hi/201012/20101210/nam_218_20101210_0000_012.grb

   # Use wgrib to pull out the record for the land mask
   wgrib -d 360 -grib -o land_mask.grb nam_218_20101210_0000_012.grb

   # Use copygb to mask out the NAM data only over land
   # The -B option defines the masking region and the -A option
defines a threshold to be applied to that field
   copygb -x -B land_mask.grb -A '>0' nam_218_20101210_0000_012.grb
nam_over_land.grb

   Attached you can see picture of the NAM data before the masking and
after the masking.  These were created using the IDV tool.

(4) Also, please note that the masking region does not need to be on
the same grid as the input region.  For example:
   # Retrieve a GFS file
   wget http://nomads.ncdc.noaa.gov/data/gfs-avn-
hi/201012/20101210/gfs_3_20101210_0000_012.grb

   # Mask out the GFS data only over the NAM domain
   copygb -x -B nam_218_20101210_0000_012.grb
gfs_3_20101210_0000_012.grb gfs_masked_by_nam.grb

   Again, I've attached images of the GFS data before and after this
masking operation.  But note that this has not actually changed the
definition of the grid - just where the data is valid.

Hope that helps.

Thanks,
John Halley Gotway

On 12/14/2010 09:23 AM, RAL HelpDesk {for Satish Regonda} wrote:
>
> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
>
>
> Dear John Halley Gotway,
>    I did register. Kindly let me know if you need any additional
> information.
> thanks much,
> Satish
>
> ----- Original Message -----
> From: RAL HelpDesk {for John Halley Gotway} <met_help at ucar.edu>
> Date: Tuesday, December 14, 2010 11:18 am
> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
region
> (ggrib,copygb)
>
>> Satish,
>>
>> We are not able to offer direct support to users who have not yet
>> registered on the MET website.  We do this to ensure that we remain
>> in compliance with the international export laws of the United
>> States.
>>
>> To fill out the free registration, please go here:
>>   http://www.dtcenter.org/met/users/downloads/index.php
>>
>> Enter your email address in the box and hit enter.  That'll take
>> you to the registration page.
>>
>> Please write us back to let us know when you've registered.
>>
>> Thanks,
>> John Halley Gotway
>> met_help at ucar.edu
>>
>> On 12/14/2010 08:26 AM, RAL HelpDesk {for Satish Regonda} wrote:
>>>
>>> Tue Dec 14 08:26:56 2010: Request 42754 was acted upon.
>>> Transaction: Ticket created by Satish.Regonda at noaa.gov
>>>        Queue: met_help
>>>      Subject: copy GRIBdata for a smaller region (ggrib,copygb)
>>>        Owner: Nobody
>>>   Requestors: Satish.Regonda at noaa.gov
>>>       Status: new
>>>  Ticket <URL:
>> https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
>>>
>>>
>>> Hi,
>>>     I like to extract data from a grib file for a smaller region
>> (e.g.,
>>> CONUS) on its native grid; I do not want to do  any
>> interpolation. I
>>> understood that copygb and ggrib will do the job but unable to
>> figure out.
>>> 1. copygb options,  "-B" and "-g" (grid= -1 yields output grid as
>> input
>>> grid), might do the job but did not find any guidelines to pass
>> lat and
>>> long information of a region that I want to extract the data
>>> 2. ggrib should do the job but when I executed the following
>> messaged
>>> displayed.
>>>
>>> $ ggrib test.grib conus_test.grib -130 25 -50 55
>>> ERROR: Grid #   1 not in geographic coordinates (lon,lat), exiting
>>>
>>> Any help is greatly appreciated.
>>> Thanks much,
>>> Satish
>>>
>>>
>>
>>

------------------------------------------------
Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller region (ggrib,copygb)
From: Satish Regonda
Time: Tue Dec 14 11:15:54 2010

Dear John Halley Gotway,
   Thanks very much for the detailed useful information.
   You got it what I want to do, i.e., extract information for a
smaller
regions with out any interpolation. I am in the process of downloading
CFSV2 hindcasts and as you know these require a lot of storage space
and
am hoping extracting data on to CONUS region greatly decrease storage
requirements.'mask' option does not offer much help as it keeps the
entire data in the file.
   I have already gone through the tutorial that you mentioned and
felt
"Interpolate to a pre-defined NCEP grid" will be useful. My  gribdata
is
on Gaussian grid, as per the table the value is 126. So, a pre-defined
grid that corresponds to CONUS region with Gaussian T126 grid will
solve
my problem but did not find the same in the list of the pre-defined
NCEP
grids (http://www.nco.ncep.noaa.gov/pmb/docs/on388/tableb.html).
   ggrib is one of the ncep products
(http://www.cpc.ncep.noaa.gov/products/wesley/ggrib.html), if this
works
my problem solved but is not working for me.

     Kindly let me know your suggestions.
Thanks much
Satish




----- Original Message -----
From: RAL HelpDesk {for John Halley Gotway} <met_help at ucar.edu>
Date: Tuesday, December 14, 2010 12:06 pm
Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
region
(ggrib,copygb)

> Satish,
>
> First, I'm not familiar with ggrib - we only really use copygb here.
>
> So I understand that you'd like to create a subset of a GRIB record
> without actually interpolating it.  The short answer is that I do
> not know how to do that directly.
>
> I believe that if you'd like to only look at a subset of the data
> that would by definition change how the grid is defined.  For
> example, if you want to reduce the number of grid point you're look
> at -
> say from 360x180 down to 100x100 - that would change the grid
> definition.  And you'd need to regrid using the "-g" option in
> copygb to do that regridding.  However, if you just want to "mask"
> out a
> subset of the data in your input file you do have some options.
>
> So here are some things you may want to consider trying:
>
> (1) First, you could create a user-defined grid to regrid your data
> using the "-g" option.  We've included some examples in the MET
> online tutorial describing how to do this:
>
>
http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/index.phpJust
click on the forward arrow to advance through the pages.  If you
choose
a grid who's grid points are very similar to the input grid, the
effect
of interpolating will be very minimal.  For a
> lat/lon grid, you should be able to define an exact subset.  For
> other projections, that'd be more difficult.
>
> (2) If you're using this GRIB data as input to the MET tools, you
> could just leave the data on it's native domain.  And then in MET,
> you can using the "mask_grid" and "mask_poly" options in the
> configuration files to define the subsets of the grid over which
> you'd like to perform the verification.
>
> (3) You can use copygb to "mask out" subsets of your domain in
> which your interested.  Please note, this will NOT regrid the data,
> just mask it out on it's native grid.  Here are some examples:
>   # Retrieve a sample NAM file
>   wget http://nomads.ncdc.noaa.gov/data/meso-eta-
> hi/201012/20101210/nam_218_20101210_0000_012.grb
>   # Use wgrib to pull out the record for the land mask
>   wgrib -d 360 -grib -o land_mask.grb nam_218_20101210_0000_012.grb
>
>   # Use copygb to mask out the NAM data only over land
>   # The -B option defines the masking region and the -A option
> defines a threshold to be applied to that field
>   copygb -x -B land_mask.grb -A '>0' nam_218_20101210_0000_012.grb
> nam_over_land.grb
>   Attached you can see picture of the NAM data before the masking
> and after the masking.  These were created using the IDV tool.
>
> (4) Also, please note that the masking region does not need to be
> on the same grid as the input region.  For example:
>   # Retrieve a GFS file
>   wget http://nomads.ncdc.noaa.gov/data/gfs-avn-
> hi/201012/20101210/gfs_3_20101210_0000_012.grb
>   # Mask out the GFS data only over the NAM domain
>   copygb -x -B nam_218_20101210_0000_012.grb
> gfs_3_20101210_0000_012.grb gfs_masked_by_nam.grb
>
>   Again, I've attached images of the GFS data before and after
> this masking operation.  But note that this has not actually
> changed the definition of the grid - just where the data is valid.
>
> Hope that helps.
>
> Thanks,
> John Halley Gotway
>
> On 12/14/2010 09:23 AM, RAL HelpDesk {for Satish Regonda} wrote:
> >
> > <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
> >
> >
> > Dear John Halley Gotway,
> >    I did register. Kindly let me know if you need any additional
> > information.
> > thanks much,
> > Satish
> >
> > ----- Original Message -----
> > From: RAL HelpDesk {for John Halley Gotway} <met_help at ucar.edu>
> > Date: Tuesday, December 14, 2010 11:18 am
> > Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
> region> (ggrib,copygb)
> >
> >> Satish,
> >>
> >> We are not able to offer direct support to users who have not
> yet
> >> registered on the MET website.  We do this to ensure that we
> remain
> >> in compliance with the international export laws of the United
> >> States.
> >>
> >> To fill out the free registration, please go here:
> >>   http://www.dtcenter.org/met/users/downloads/index.php
> >>
> >> Enter your email address in the box and hit enter.  That'll take
> >> you to the registration page.
> >>
> >> Please write us back to let us know when you've registered.
> >>
> >> Thanks,
> >> John Halley Gotway
> >> met_help at ucar.edu
> >>
> >> On 12/14/2010 08:26 AM, RAL HelpDesk {for Satish Regonda} wrote:
> >>>
> >>> Tue Dec 14 08:26:56 2010: Request 42754 was acted upon.
> >>> Transaction: Ticket created by Satish.Regonda at noaa.gov
> >>>        Queue: met_help
> >>>      Subject: copy GRIBdata for a smaller region (ggrib,copygb)
> >>>        Owner: Nobody
> >>>   Requestors: Satish.Regonda at noaa.gov
> >>>       Status: new
> >>>  Ticket <URL:
> >> https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
> >>>
> >>>
> >>> Hi,
> >>>     I like to extract data from a grib file for a smaller
> region
> >> (e.g.,
> >>> CONUS) on its native grid; I do not want to do  any
> >> interpolation. I
> >>> understood that copygb and ggrib will do the job but unable to
> >> figure out.
> >>> 1. copygb options,  "-B" and "-g" (grid= -1 yields output grid
> as
> >> input
> >>> grid), might do the job but did not find any guidelines to pass
> >> lat and
> >>> long information of a region that I want to extract the data
> >>> 2. ggrib should do the job but when I executed the following
> >> messaged
> >>> displayed.
> >>>
> >>> $ ggrib test.grib conus_test.grib -130 25 -50 55
> >>> ERROR: Grid #   1 not in geographic coordinates (lon,lat),
exiting
> >>>
> >>> Any help is greatly appreciated.
> >>> Thanks much,
> >>> Satish
> >>>
> >>>
> >>
> >>
>
>

------------------------------------------------
Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller region (ggrib,copygb)
From: John Halley Gotway
Time: Tue Dec 14 11:49:21 2010

Satish,

Actually, the masking does in fact reduce the file size.  Here are the
sizes for the files who's picture I sent:

-rw-r--r-- 1 johnhg rap4  32M 2010-12-10 00:04
gfs_3_20101210_0000_012.grb
-rwxr-xr-x 1 johnhg rap4 4.4M 2010-12-14 10:03 gfs_masked_by_nam.grb*
-rw-r--r-- 1 johnhg rap4 118M 2010-12-10 00:15
nam_218_20101210_0000_012.grb
-rwxr-xr-x 1 johnhg rap4  51M 2010-12-14 09:58 nam_over_land.grb*

The GFS reduced in size from 32M down to 4.4M when masking over CONUS.
And the NAM reduced in size from 118M down to 51M when masking over
land.

copygb does in fact throw away that data is isn't using.  It stores a
0/1 bitmap field to define where it does/does not have data.  It only
stores the data values where the bitmap is set to 1.

So masking the data may in fact be a reasonable way of reducing the
file size.  Of course, regridding it using the "-g" option of copygb
would work too.

John


On 12/14/2010 11:15 AM, RAL HelpDesk {for Satish Regonda} wrote:
>
> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
>
> Dear John Halley Gotway,
>    Thanks very much for the detailed useful information.
>    You got it what I want to do, i.e., extract information for a
smaller
> regions with out any interpolation. I am in the process of
downloading
> CFSV2 hindcasts and as you know these require a lot of storage space
and
> am hoping extracting data on to CONUS region greatly decrease
storage
> requirements.'mask' option does not offer much help as it keeps the
> entire data in the file.
>    I have already gone through the tutorial that you mentioned and
felt
> "Interpolate to a pre-defined NCEP grid" will be useful. My
gribdata is
> on Gaussian grid, as per the table the value is 126. So, a pre-
defined
> grid that corresponds to CONUS region with Gaussian T126 grid will
solve
> my problem but did not find the same in the list of the pre-defined
NCEP
> grids (http://www.nco.ncep.noaa.gov/pmb/docs/on388/tableb.html).
>    ggrib is one of the ncep products
> (http://www.cpc.ncep.noaa.gov/products/wesley/ggrib.html), if this
works
> my problem solved but is not working for me.
>
>      Kindly let me know your suggestions.
> Thanks much
> Satish
>
>
>
>
> ----- Original Message -----
> From: RAL HelpDesk {for John Halley Gotway} <met_help at ucar.edu>
> Date: Tuesday, December 14, 2010 12:06 pm
> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
region
> (ggrib,copygb)
>
>> Satish,
>>
>> First, I'm not familiar with ggrib - we only really use copygb
here.
>>
>> So I understand that you'd like to create a subset of a GRIB record
>> without actually interpolating it.  The short answer is that I do
>> not know how to do that directly.
>>
>> I believe that if you'd like to only look at a subset of the data
>> that would by definition change how the grid is defined.  For
>> example, if you want to reduce the number of grid point you're look
>> at -
>> say from 360x180 down to 100x100 - that would change the grid
>> definition.  And you'd need to regrid using the "-g" option in
>> copygb to do that regridding.  However, if you just want to "mask"
>> out a
>> subset of the data in your input file you do have some options.
>>
>> So here are some things you may want to consider trying:
>>
>> (1) First, you could create a user-defined grid to regrid your data
>> using the "-g" option.  We've included some examples in the MET
>> online tutorial describing how to do this:
>>
>>
>
http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/index.phpJust
> click on the forward arrow to advance through the pages.  If you
choose
> a grid who's grid points are very similar to the input grid, the
effect
> of interpolating will be very minimal.  For a
>> lat/lon grid, you should be able to define an exact subset.  For
>> other projections, that'd be more difficult.
>>
>> (2) If you're using this GRIB data as input to the MET tools, you
>> could just leave the data on it's native domain.  And then in MET,
>> you can using the "mask_grid" and "mask_poly" options in the
>> configuration files to define the subsets of the grid over which
>> you'd like to perform the verification.
>>
>> (3) You can use copygb to "mask out" subsets of your domain in
>> which your interested.  Please note, this will NOT regrid the data,
>> just mask it out on it's native grid.  Here are some examples:
>>   # Retrieve a sample NAM file
>>   wget http://nomads.ncdc.noaa.gov/data/meso-eta-
>> hi/201012/20101210/nam_218_20101210_0000_012.grb
>>   # Use wgrib to pull out the record for the land mask
>>   wgrib -d 360 -grib -o land_mask.grb nam_218_20101210_0000_012.grb
>>
>>   # Use copygb to mask out the NAM data only over land
>>   # The -B option defines the masking region and the -A option
>> defines a threshold to be applied to that field
>>   copygb -x -B land_mask.grb -A '>0' nam_218_20101210_0000_012.grb
>> nam_over_land.grb
>>   Attached you can see picture of the NAM data before the masking
>> and after the masking.  These were created using the IDV tool.
>>
>> (4) Also, please note that the masking region does not need to be
>> on the same grid as the input region.  For example:
>>   # Retrieve a GFS file
>>   wget http://nomads.ncdc.noaa.gov/data/gfs-avn-
>> hi/201012/20101210/gfs_3_20101210_0000_012.grb
>>   # Mask out the GFS data only over the NAM domain
>>   copygb -x -B nam_218_20101210_0000_012.grb
>> gfs_3_20101210_0000_012.grb gfs_masked_by_nam.grb
>>
>>   Again, I've attached images of the GFS data before and after
>> this masking operation.  But note that this has not actually
>> changed the definition of the grid - just where the data is valid.
>>
>> Hope that helps.
>>
>> Thanks,
>> John Halley Gotway
>>
>> On 12/14/2010 09:23 AM, RAL HelpDesk {for Satish Regonda} wrote:
>>>
>>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
>>>
>>>
>>> Dear John Halley Gotway,
>>>    I did register. Kindly let me know if you need any additional
>>> information.
>>> thanks much,
>>> Satish
>>>
>>> ----- Original Message -----
>>> From: RAL HelpDesk {for John Halley Gotway} <met_help at ucar.edu>
>>> Date: Tuesday, December 14, 2010 11:18 am
>>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
>> region> (ggrib,copygb)
>>>
>>>> Satish,
>>>>
>>>> We are not able to offer direct support to users who have not
>> yet
>>>> registered on the MET website.  We do this to ensure that we
>> remain
>>>> in compliance with the international export laws of the United
>>>> States.
>>>>
>>>> To fill out the free registration, please go here:
>>>>   http://www.dtcenter.org/met/users/downloads/index.php
>>>>
>>>> Enter your email address in the box and hit enter.  That'll take
>>>> you to the registration page.
>>>>
>>>> Please write us back to let us know when you've registered.
>>>>
>>>> Thanks,
>>>> John Halley Gotway
>>>> met_help at ucar.edu
>>>>
>>>> On 12/14/2010 08:26 AM, RAL HelpDesk {for Satish Regonda} wrote:
>>>>>
>>>>> Tue Dec 14 08:26:56 2010: Request 42754 was acted upon.
>>>>> Transaction: Ticket created by Satish.Regonda at noaa.gov
>>>>>        Queue: met_help
>>>>>      Subject: copy GRIBdata for a smaller region (ggrib,copygb)
>>>>>        Owner: Nobody
>>>>>   Requestors: Satish.Regonda at noaa.gov
>>>>>       Status: new
>>>>>  Ticket <URL:
>>>> https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
>>>>>
>>>>>
>>>>> Hi,
>>>>>     I like to extract data from a grib file for a smaller
>> region
>>>> (e.g.,
>>>>> CONUS) on its native grid; I do not want to do  any
>>>> interpolation. I
>>>>> understood that copygb and ggrib will do the job but unable to
>>>> figure out.
>>>>> 1. copygb options,  "-B" and "-g" (grid= -1 yields output grid
>> as
>>>> input
>>>>> grid), might do the job but did not find any guidelines to pass
>>>> lat and
>>>>> long information of a region that I want to extract the data
>>>>> 2. ggrib should do the job but when I executed the following
>>>> messaged
>>>>> displayed.
>>>>>
>>>>> $ ggrib test.grib conus_test.grib -130 25 -50 55
>>>>> ERROR: Grid #   1 not in geographic coordinates (lon,lat),
exiting
>>>>>
>>>>> Any help is greatly appreciated.
>>>>> Thanks much,
>>>>> Satish
>>>>>
>>>>>
>>>>
>>>>
>>
>>

------------------------------------------------
Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller region (ggrib,copygb)
From: Satish Regonda
Time: Tue Dec 14 15:00:31 2010

Dear John Halley Gotway,
   This helps a lot. Figures made me to understand easily. I have few
questions and request you provide some light on the same. Also,
request
you to correct me if I am wrong on the following.

1. wgrib -d 360 -grib -o land_mask.grb nam_218_20101210_0000_012.grb
    Record 360 corresponds to land mass and the above commands pulls
out
all the information corresponding to land mass (of North America).
This
information will be having lat/long information as well and is
supplied
to copygb. Please confirm. If it so, how can I pull out information
that
corresponds to CONUS? I believe supplying lat-long information of
CONUS
in a grib file via copygb provides solution to my problem.

2. 'copygb' command reads lat/long information from a file that is
followed by -B and then reads data corresponds to this region from
input
file, and then writes into output file. If this is so, the following
command should do the job for me. Please confirm.
  copygv -x -B conus_lat_long_file inputfile.grib outputfile.grib

   As you mentioned it is not necessary that files entitled
"conus_lat_long_file" and  "inputfile.grib" not necessarily on the
same
grid scale.

3. You did use option  -A '>0', does it retain values only that are
greater than "0"?

4. I ran the following command, and I believe that it masks landmass
region. The file size decreased from 51M to 6.1 M. I ran "wgrib -V"
for
the first record of two files and from outset it looks like the same
Gaussian grid maintained in two files. one variable "bitmap: 68724
undef" is added but am not sure what is it.

 copygb -x -B land_mask.grb test.grib test_land_maks.grib


$ wgrib -V test.grib -d 0
rec 1:0:date 1999010100 PRATE kpds5=59 kpds6=1 kpds7=0 levels=(0,0)
grid=126 sfc 6hr fcst:
  PRATE=Precipitation rate [kg/m^2/s]
  timerange 10 P1 0 P2 6 TimeU 1  nx 384 ny 190 GDS grid 4 num_in_ave
0
missing 0
  center 7 subcenter 0 process 82 Table 2 scan: WE:NS winds(N/S)
  gaussian: lat  89.277000 to -89.277000
            long 0.000000 to -0.938000 by 0.938000, (384 x 190) scan 0
mode 128 bdsgrid 1
  min/max data 0 0.002421  num bits 12  BDS_Ref 0  DecScale 6 BinScale
0

$  wgrib -V test_land_maks.grib  -d 0
rec 1:4:date 1999010100 PRATE kpds5=59 kpds6=1 kpds7=0 levels=(0,0)
grid=126 sfc 6hr fcst: bitmap: 68724 undef
  PRATE=Precipitation rate [kg/m^2/s]
  timerange 10 P1 0 P2 6 TimeU 1  nx 384 ny 190 GDS grid 4 num_in_ave
0
missing 0
  center 7 subcenter 0 process 82 Table 2 scan: WE:NS winds(N/S)
  gaussian: lat  89.277000 to -89.277000
            long 0.000000 to -0.938000 by 0.938000, (384 x 190) scan 0
mode 128 bdsgrid 1
  min/max data 0 0.00057  num bits 10  BDS_Ref 0  DecScale 6 BinScale
0

6. regridding using the "-g" option: Having grid that covers CONUS
region @ Gaussian scale makes my problem simple. I did look into the
table but did not find the grid. If you know any information on this
kindly let me know.

   Greatly appreciate your answers/suggestions.
Thanks much,
Satish

----- Original Message -----
From: RAL HelpDesk {for John Halley Gotway} <met_help at ucar.edu>
Date: Tuesday, December 14, 2010 1:49 pm
Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
region
(ggrib,copygb)

> Satish,
>
> Actually, the masking does in fact reduce the file size.  Here are
> the sizes for the files who's picture I sent:
>
> -rw-r--r-- 1 johnhg rap4  32M 2010-12-10 00:04
> gfs_3_20101210_0000_012.grb-rwxr-xr-x 1 johnhg rap4 4.4M 2010-12-14
> 10:03 gfs_masked_by_nam.grb*
> -rw-r--r-- 1 johnhg rap4 118M 2010-12-10 00:15
> nam_218_20101210_0000_012.grb-rwxr-xr-x 1 johnhg rap4  51M 2010-12-
> 14 09:58 nam_over_land.grb*
>
> The GFS reduced in size from 32M down to 4.4M when masking over
> CONUS.  And the NAM reduced in size from 118M down to 51M when
> masking over land.
>
> copygb does in fact throw away that data is isn't using.  It stores
> a 0/1 bitmap field to define where it does/does not have data.  It
> only stores the data values where the bitmap is set to 1.
>
> So masking the data may in fact be a reasonable way of reducing the
> file size.  Of course, regridding it using the "-g" option of
> copygb would work too.
>
> John
>
>
> On 12/14/2010 11:15 AM, RAL HelpDesk {for Satish Regonda} wrote:
> >
> > <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
> >
> > Dear John Halley Gotway,
> >    Thanks very much for the detailed useful information.
> >    You got it what I want to do, i.e., extract information for a
> smaller> regions with out any interpolation. I am in the process of
> downloading> CFSV2 hindcasts and as you know these require a lot of
> storage space and
> > am hoping extracting data on to CONUS region greatly decrease
> storage> requirements.'mask' option does not offer much help as it
> keeps the
> > entire data in the file.
> >    I have already gone through the tutorial that you mentioned
> and felt
> > "Interpolate to a pre-defined NCEP grid" will be useful. My
> gribdata is
> > on Gaussian grid, as per the table the value is 126. So, a pre-
> defined> grid that corresponds to CONUS region with Gaussian T126
> grid will solve
> > my problem but did not find the same in the list of the pre-
> defined NCEP
> > grids (http://www.nco.ncep.noaa.gov/pmb/docs/on388/tableb.html).
> >    ggrib is one of the ncep products
> > (http://www.cpc.ncep.noaa.gov/products/wesley/ggrib.html), if
> this works
> > my problem solved but is not working for me.
> >
> >      Kindly let me know your suggestions.
> > Thanks much
> > Satish
> >
> >
> >
> >
> > ----- Original Message -----
> > From: RAL HelpDesk {for John Halley Gotway} <met_help at ucar.edu>
> > Date: Tuesday, December 14, 2010 12:06 pm
> > Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
> region> (ggrib,copygb)
> >
> >> Satish,
> >>
> >> First, I'm not familiar with ggrib - we only really use copygb
> here.>>
> >> So I understand that you'd like to create a subset of a GRIB
> record
> >> without actually interpolating it.  The short answer is that I
> do
> >> not know how to do that directly.
> >>
> >> I believe that if you'd like to only look at a subset of the
> data
> >> that would by definition change how the grid is defined.  For
> >> example, if you want to reduce the number of grid point you're
> look
> >> at -
> >> say from 360x180 down to 100x100 - that would change the grid
> >> definition.  And you'd need to regrid using the "-g" option in
> >> copygb to do that regridding.  However, if you just want to
> "mask"
> >> out a
> >> subset of the data in your input file you do have some options.
> >>
> >> So here are some things you may want to consider trying:
> >>
> >> (1) First, you could create a user-defined grid to regrid your
> data
> >> using the "-g" option.  We've included some examples in the MET
> >> online tutorial describing how to do this:
> >>
> >>
> >
>
http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/index.phpJust>
click on the forward arrow to advance through the pages.  If you
choose
> > a grid who's grid points are very similar to the input grid, the
> effect> of interpolating will be very minimal.  For a
> >> lat/lon grid, you should be able to define an exact subset.  For
> >> other projections, that'd be more difficult.
> >>
> >> (2) If you're using this GRIB data as input to the MET tools,
> you
> >> could just leave the data on it's native domain.  And then in
> MET,
> >> you can using the "mask_grid" and "mask_poly" options in the
> >> configuration files to define the subsets of the grid over which
> >> you'd like to perform the verification.
> >>
> >> (3) You can use copygb to "mask out" subsets of your domain in
> >> which your interested.  Please note, this will NOT regrid the
> data,
> >> just mask it out on it's native grid.  Here are some examples:
> >>   # Retrieve a sample NAM file
> >>   wget http://nomads.ncdc.noaa.gov/data/meso-eta-
> >> hi/201012/20101210/nam_218_20101210_0000_012.grb
> >>   # Use wgrib to pull out the record for the land mask
> >>   wgrib -d 360 -grib -o land_mask.grb
nam_218_20101210_0000_012.grb
> >>
> >>   # Use copygb to mask out the NAM data only over land
> >>   # The -B option defines the masking region and the -A option
> >> defines a threshold to be applied to that field
> >>   copygb -x -B land_mask.grb -A '>0'
> nam_218_20101210_0000_012.grb
> >> nam_over_land.grb
> >>   Attached you can see picture of the NAM data before the
> masking
> >> and after the masking.  These were created using the IDV tool.
> >>
> >> (4) Also, please note that the masking region does not need to
> be
> >> on the same grid as the input region.  For example:
> >>   # Retrieve a GFS file
> >>   wget http://nomads.ncdc.noaa.gov/data/gfs-avn-
> >> hi/201012/20101210/gfs_3_20101210_0000_012.grb
> >>   # Mask out the GFS data only over the NAM domain
> >>   copygb -x -B nam_218_20101210_0000_012.grb
> >> gfs_3_20101210_0000_012.grb gfs_masked_by_nam.grb
> >>
> >>   Again, I've attached images of the GFS data before and after
> >> this masking operation.  But note that this has not actually
> >> changed the definition of the grid - just where the data is
valid.
> >>
> >> Hope that helps.
> >>
> >> Thanks,
> >> John Halley Gotway
> >>
> >> On 12/14/2010 09:23 AM, RAL HelpDesk {for Satish Regonda} wrote:
> >>>
> >>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
> >>>
> >>>
> >>> Dear John Halley Gotway,
> >>>    I did register. Kindly let me know if you need any additional
> >>> information.
> >>> thanks much,
> >>> Satish
> >>>
> >>> ----- Original Message -----
> >>> From: RAL HelpDesk {for John Halley Gotway} <met_help at ucar.edu>
> >>> Date: Tuesday, December 14, 2010 11:18 am
> >>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a
> smaller
> >> region> (ggrib,copygb)
> >>>
> >>>> Satish,
> >>>>
> >>>> We are not able to offer direct support to users who have not
> >> yet
> >>>> registered on the MET website.  We do this to ensure that we
> >> remain
> >>>> in compliance with the international export laws of the United
> >>>> States.
> >>>>
> >>>> To fill out the free registration, please go here:
> >>>>   http://www.dtcenter.org/met/users/downloads/index.php
> >>>>
> >>>> Enter your email address in the box and hit enter.  That'll
> take
> >>>> you to the registration page.
> >>>>
> >>>> Please write us back to let us know when you've registered.
> >>>>
> >>>> Thanks,
> >>>> John Halley Gotway
> >>>> met_help at ucar.edu
> >>>>
> >>>> On 12/14/2010 08:26 AM, RAL HelpDesk {for Satish Regonda}
wrote:
> >>>>>
> >>>>> Tue Dec 14 08:26:56 2010: Request 42754 was acted upon.
> >>>>> Transaction: Ticket created by Satish.Regonda at noaa.gov
> >>>>>        Queue: met_help
> >>>>>      Subject: copy GRIBdata for a smaller region
(ggrib,copygb)
> >>>>>        Owner: Nobody
> >>>>>   Requestors: Satish.Regonda at noaa.gov
> >>>>>       Status: new
> >>>>>  Ticket <URL:
> >>>> https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
> >>>>>
> >>>>>
> >>>>> Hi,
> >>>>>     I like to extract data from a grib file for a smaller
> >> region
> >>>> (e.g.,
> >>>>> CONUS) on its native grid; I do not want to do  any
> >>>> interpolation. I
> >>>>> understood that copygb and ggrib will do the job but unable
> to
> >>>> figure out.
> >>>>> 1. copygb options,  "-B" and "-g" (grid= -1 yields output
> grid
> >> as
> >>>> input
> >>>>> grid), might do the job but did not find any guidelines to
> pass
> >>>> lat and
> >>>>> long information of a region that I want to extract the data
> >>>>> 2. ggrib should do the job but when I executed the following
> >>>> messaged
> >>>>> displayed.
> >>>>>
> >>>>> $ ggrib test.grib conus_test.grib -130 25 -50 55
> >>>>> ERROR: Grid #   1 not in geographic coordinates (lon,lat),
> exiting>>>>>
> >>>>> Any help is greatly appreciated.
> >>>>> Thanks much,
> >>>>> Satish
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>
> >>
>
>

------------------------------------------------
Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller region (ggrib,copygb)
From: John Halley Gotway
Time: Fri Dec 17 16:17:06 2010

Satish,

My responses are inline...

On 12/14/2010 03:00 PM, RAL HelpDesk {for Satish Regonda} wrote:
>
> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
>
> Dear John Halley Gotway,
>    This helps a lot. Figures made me to understand easily. I have
few
> questions and request you provide some light on the same. Also,
request
> you to correct me if I am wrong on the following.
>
> 1. wgrib -d 360 -grib -o land_mask.grb nam_218_20101210_0000_012.grb
>     Record 360 corresponds to land mass and the above commands pulls
out
> all the information corresponding to land mass (of North America).
This
> information will be having lat/long information as well and is
supplied
> to copygb. Please confirm. If it so, how can I pull out information
that
> corresponds to CONUS? I believe supplying lat-long information of
CONUS
> in a grib file via copygb provides solution to my problem.
>
Yes, this is correct.  "-d 360" tells copygb to only extract record
number 360 which does contain the record for "LAND" which is a 0/1
mask for where there's land versus water.  The lat/lon
information is contained in the Grid Description Section (GDS) section
of each GRIB record.  To my knowledge, there isn't a way of providing
lat/lon's to use to subset the domain.

> 2. 'copygb' command reads lat/long information from a file that is
> followed by -B and then reads data corresponds to this region from
input
> file, and then writes into output file. If this is so, the following
> command should do the job for me. Please confirm.
>   copygv -x -B conus_lat_long_file inputfile.grib outputfile.grib
>
>    As you mentioned it is not necessary that files entitled
> "conus_lat_long_file" and  "inputfile.grib" not necessarily on the
same
> grid scale.
>
Yes, that's true "conus_lat_long_file" and "inputfile.grib" do not
need to be on the same grid.  However, I believe your
"conus_lat_long_file" has to be a GRIB file.



> 3. You did use option  -A '>0', does it retain values only that are
> greater than "0"?

Yes, in that example listed below, "-A '>0'" tells copygb to only use
the grid points where the file land_mask.grb has a value greater than
0.
  copygb -x -B land_mask.grb -A '>0' nam_218_20101210_0000_012.grb
nam_over_land.grb

>
> 4. I ran the following command, and I believe that it masks landmass
> region. The file size decreased from 51M to 6.1 M. I ran "wgrib -V"
for
> the first record of two files and from outset it looks like the same
> Gaussian grid maintained in two files. one variable "bitmap: 68724
> undef" is added but am not sure what is it.
>
>  copygb -x -B land_mask.grb test.grib test_land_maks.grib
>
>
> $ wgrib -V test.grib -d 0
> rec 1:0:date 1999010100 PRATE kpds5=59 kpds6=1 kpds7=0 levels=(0,0)
> grid=126 sfc 6hr fcst:
>   PRATE=Precipitation rate [kg/m^2/s]
>   timerange 10 P1 0 P2 6 TimeU 1  nx 384 ny 190 GDS grid 4
num_in_ave 0
> missing 0
>   center 7 subcenter 0 process 82 Table 2 scan: WE:NS winds(N/S)
>   gaussian: lat  89.277000 to -89.277000
>             long 0.000000 to -0.938000 by 0.938000, (384 x 190) scan
0
> mode 128 bdsgrid 1
>   min/max data 0 0.002421  num bits 12  BDS_Ref 0  DecScale 6
BinScale 0
>
> $  wgrib -V test_land_maks.grib  -d 0
> rec 1:4:date 1999010100 PRATE kpds5=59 kpds6=1 kpds7=0 levels=(0,0)
> grid=126 sfc 6hr fcst: bitmap: 68724 undef
>   PRATE=Precipitation rate [kg/m^2/s]
>   timerange 10 P1 0 P2 6 TimeU 1  nx 384 ny 190 GDS grid 4
num_in_ave 0
> missing 0
>   center 7 subcenter 0 process 82 Table 2 scan: WE:NS winds(N/S)
>   gaussian: lat  89.277000 to -89.277000
>             long 0.000000 to -0.938000 by 0.938000, (384 x 190) scan
0
> mode 128 bdsgrid 1
>   min/max data 0 0.00057  num bits 10  BDS_Ref 0  DecScale 6
BinScale 0
>

When you do the masking using the "-B" option, the grid definitions
will remain unchanged.  Remember, this isn't regridding the data, it's
just masking it out.  However, when you look at the file
sizes before and after, the one after the masking should be smaller.

> 6. regridding using the "-g" option: Having grid that covers CONUS
> region @ Gaussian scale makes my problem simple. I did look into the
> table but did not find the grid. If you know any information on this
> kindly let me know.

This is what I'm trying to tell you.  There is no predefined grid you
should use.  Instead, you should define your own grid specification
that matches closely with the CONUS subset you'd like to use.
 Please look at the following website for an example of defining your
own custom grid:
   http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/run2.php

Just look at the example on that page, and try to define your own grid
that makes sense for your data.

Hope that helps.

John Halley Gotway

>
>    Greatly appreciate your answers/suggestions.
> Thanks much,
> Satish
>
> ----- Original Message -----
> From: RAL HelpDesk {for John Halley Gotway} <met_help at ucar.edu>
> Date: Tuesday, December 14, 2010 1:49 pm
> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
region
> (ggrib,copygb)
>
>> Satish,
>>
>> Actually, the masking does in fact reduce the file size.  Here are
>> the sizes for the files who's picture I sent:
>>
>> -rw-r--r-- 1 johnhg rap4  32M 2010-12-10 00:04
>> gfs_3_20101210_0000_012.grb-rwxr-xr-x 1 johnhg rap4 4.4M 2010-12-14
>> 10:03 gfs_masked_by_nam.grb*
>> -rw-r--r-- 1 johnhg rap4 118M 2010-12-10 00:15
>> nam_218_20101210_0000_012.grb-rwxr-xr-x 1 johnhg rap4  51M 2010-12-
>> 14 09:58 nam_over_land.grb*
>>
>> The GFS reduced in size from 32M down to 4.4M when masking over
>> CONUS.  And the NAM reduced in size from 118M down to 51M when
>> masking over land.
>>
>> copygb does in fact throw away that data is isn't using.  It stores
>> a 0/1 bitmap field to define where it does/does not have data.  It
>> only stores the data values where the bitmap is set to 1.
>>
>> So masking the data may in fact be a reasonable way of reducing the
>> file size.  Of course, regridding it using the "-g" option of
>> copygb would work too.
>>
>> John
>>
>>
>> On 12/14/2010 11:15 AM, RAL HelpDesk {for Satish Regonda} wrote:
>>>
>>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
>>>
>>> Dear John Halley Gotway,
>>>    Thanks very much for the detailed useful information.
>>>    You got it what I want to do, i.e., extract information for a
>> smaller> regions with out any interpolation. I am in the process of
>> downloading> CFSV2 hindcasts and as you know these require a lot of
>> storage space and
>>> am hoping extracting data on to CONUS region greatly decrease
>> storage> requirements.'mask' option does not offer much help as it
>> keeps the
>>> entire data in the file.
>>>    I have already gone through the tutorial that you mentioned
>> and felt
>>> "Interpolate to a pre-defined NCEP grid" will be useful. My
>> gribdata is
>>> on Gaussian grid, as per the table the value is 126. So, a pre-
>> defined> grid that corresponds to CONUS region with Gaussian T126
>> grid will solve
>>> my problem but did not find the same in the list of the pre-
>> defined NCEP
>>> grids (http://www.nco.ncep.noaa.gov/pmb/docs/on388/tableb.html).
>>>    ggrib is one of the ncep products
>>> (http://www.cpc.ncep.noaa.gov/products/wesley/ggrib.html), if
>> this works
>>> my problem solved but is not working for me.
>>>
>>>      Kindly let me know your suggestions.
>>> Thanks much
>>> Satish
>>>
>>>
>>>
>>>
>>> ----- Original Message -----
>>> From: RAL HelpDesk {for John Halley Gotway} <met_help at ucar.edu>
>>> Date: Tuesday, December 14, 2010 12:06 pm
>>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
>> region> (ggrib,copygb)
>>>
>>>> Satish,
>>>>
>>>> First, I'm not familiar with ggrib - we only really use copygb
>> here.>>
>>>> So I understand that you'd like to create a subset of a GRIB
>> record
>>>> without actually interpolating it.  The short answer is that I
>> do
>>>> not know how to do that directly.
>>>>
>>>> I believe that if you'd like to only look at a subset of the
>> data
>>>> that would by definition change how the grid is defined.  For
>>>> example, if you want to reduce the number of grid point you're
>> look
>>>> at -
>>>> say from 360x180 down to 100x100 - that would change the grid
>>>> definition.  And you'd need to regrid using the "-g" option in
>>>> copygb to do that regridding.  However, if you just want to
>> "mask"
>>>> out a
>>>> subset of the data in your input file you do have some options.
>>>>
>>>> So here are some things you may want to consider trying:
>>>>
>>>> (1) First, you could create a user-defined grid to regrid your
>> data
>>>> using the "-g" option.  We've included some examples in the MET
>>>> online tutorial describing how to do this:
>>>>
>>>>
>>>
>>
>
http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/index.phpJust>
> click on the forward arrow to advance through the pages.  If you
choose
>>> a grid who's grid points are very similar to the input grid, the
>> effect> of interpolating will be very minimal.  For a
>>>> lat/lon grid, you should be able to define an exact subset.  For
>>>> other projections, that'd be more difficult.
>>>>
>>>> (2) If you're using this GRIB data as input to the MET tools,
>> you
>>>> could just leave the data on it's native domain.  And then in
>> MET,
>>>> you can using the "mask_grid" and "mask_poly" options in the
>>>> configuration files to define the subsets of the grid over which
>>>> you'd like to perform the verification.
>>>>
>>>> (3) You can use copygb to "mask out" subsets of your domain in
>>>> which your interested.  Please note, this will NOT regrid the
>> data,
>>>> just mask it out on it's native grid.  Here are some examples:
>>>>   # Retrieve a sample NAM file
>>>>   wget http://nomads.ncdc.noaa.gov/data/meso-eta-
>>>> hi/201012/20101210/nam_218_20101210_0000_012.grb
>>>>   # Use wgrib to pull out the record for the land mask
>>>>   wgrib -d 360 -grib -o land_mask.grb
nam_218_20101210_0000_012.grb
>>>>
>>>>   # Use copygb to mask out the NAM data only over land
>>>>   # The -B option defines the masking region and the -A option
>>>> defines a threshold to be applied to that field
>>>>   copygb -x -B land_mask.grb -A '>0'
>> nam_218_20101210_0000_012.grb
>>>> nam_over_land.grb
>>>>   Attached you can see picture of the NAM data before the
>> masking
>>>> and after the masking.  These were created using the IDV tool.
>>>>
>>>> (4) Also, please note that the masking region does not need to
>> be
>>>> on the same grid as the input region.  For example:
>>>>   # Retrieve a GFS file
>>>>   wget http://nomads.ncdc.noaa.gov/data/gfs-avn-
>>>> hi/201012/20101210/gfs_3_20101210_0000_012.grb
>>>>   # Mask out the GFS data only over the NAM domain
>>>>   copygb -x -B nam_218_20101210_0000_012.grb
>>>> gfs_3_20101210_0000_012.grb gfs_masked_by_nam.grb
>>>>
>>>>   Again, I've attached images of the GFS data before and after
>>>> this masking operation.  But note that this has not actually
>>>> changed the definition of the grid - just where the data is
valid.
>>>>
>>>> Hope that helps.
>>>>
>>>> Thanks,
>>>> John Halley Gotway
>>>>
>>>> On 12/14/2010 09:23 AM, RAL HelpDesk {for Satish Regonda} wrote:
>>>>>
>>>>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
>>>>>
>>>>>
>>>>> Dear John Halley Gotway,
>>>>>    I did register. Kindly let me know if you need any additional
>>>>> information.
>>>>> thanks much,
>>>>> Satish
>>>>>
>>>>> ----- Original Message -----
>>>>> From: RAL HelpDesk {for John Halley Gotway} <met_help at ucar.edu>
>>>>> Date: Tuesday, December 14, 2010 11:18 am
>>>>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a
>> smaller
>>>> region> (ggrib,copygb)
>>>>>
>>>>>> Satish,
>>>>>>
>>>>>> We are not able to offer direct support to users who have not
>>>> yet
>>>>>> registered on the MET website.  We do this to ensure that we
>>>> remain
>>>>>> in compliance with the international export laws of the United
>>>>>> States.
>>>>>>
>>>>>> To fill out the free registration, please go here:
>>>>>>   http://www.dtcenter.org/met/users/downloads/index.php
>>>>>>
>>>>>> Enter your email address in the box and hit enter.  That'll
>> take
>>>>>> you to the registration page.
>>>>>>
>>>>>> Please write us back to let us know when you've registered.
>>>>>>
>>>>>> Thanks,
>>>>>> John Halley Gotway
>>>>>> met_help at ucar.edu
>>>>>>
>>>>>> On 12/14/2010 08:26 AM, RAL HelpDesk {for Satish Regonda}
wrote:
>>>>>>>
>>>>>>> Tue Dec 14 08:26:56 2010: Request 42754 was acted upon.
>>>>>>> Transaction: Ticket created by Satish.Regonda at noaa.gov
>>>>>>>        Queue: met_help
>>>>>>>      Subject: copy GRIBdata for a smaller region
(ggrib,copygb)
>>>>>>>        Owner: Nobody
>>>>>>>   Requestors: Satish.Regonda at noaa.gov
>>>>>>>       Status: new
>>>>>>>  Ticket <URL:
>>>>>> https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
>>>>>>>
>>>>>>>
>>>>>>> Hi,
>>>>>>>     I like to extract data from a grib file for a smaller
>>>> region
>>>>>> (e.g.,
>>>>>>> CONUS) on its native grid; I do not want to do  any
>>>>>> interpolation. I
>>>>>>> understood that copygb and ggrib will do the job but unable
>> to
>>>>>> figure out.
>>>>>>> 1. copygb options,  "-B" and "-g" (grid= -1 yields output
>> grid
>>>> as
>>>>>> input
>>>>>>> grid), might do the job but did not find any guidelines to
>> pass
>>>>>> lat and
>>>>>>> long information of a region that I want to extract the data
>>>>>>> 2. ggrib should do the job but when I executed the following
>>>>>> messaged
>>>>>>> displayed.
>>>>>>>
>>>>>>> $ ggrib test.grib conus_test.grib -130 25 -50 55
>>>>>>> ERROR: Grid #   1 not in geographic coordinates (lon,lat),
>> exiting>>>>>
>>>>>>> Any help is greatly appreciated.
>>>>>>> Thanks much,
>>>>>>> Satish
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>

------------------------------------------------
Subject: copy GRIBdata for a smaller region (ggrib,copygb)
From: Satish Regonda
Time: Wed Dec 22 11:27:16 2010

John,
    Thanks for all the information and it is very helpful. I have two
more questions and request you to to provide information

1.  File entitled "test.grib" have the data on Gaussian grid for the
entire world.

    (i). ran copygb on a customized grid that corresponds to CONUS
region, i.e., 20N-55N,130w-45w

    $ grid='255 0 201 201 20000 230000 128 55000 315000 100 100 64'
    $ copygb -g"$grid" -x test.grib test_conus.grib

         I believe that "test_conus.grib" will have lat and long
correspond to CONUS and data interpolated from it's native (Gaussian)
grid to the above mentioned customized grid.

    ii.  ran copygb command as below mentioned with "-B" option.

    $ copygb -x -B test_conus.grib test.grib test_conus_gaussian.grib

         As you mentioned, the above command masks the data without
changing grid boundary definition. Therefore,
"test_conus_gaussian.grib"
will have data only corresponds to CONUS region on it's native grid. I
ran wgrib -V command on both files, i.e., "test.grib" and
"test_conus_gaussian.grib". The summary looked almost same except some
part of the text. I am not sure what does it reflects though. In this
regard, to make sure every thing is working fine I like to compare
data
corresponds to the CONUS region from the two files.  is it possible to
do this? Greatly appreciate your suggestions.

2. I also have .grib.index files. I need to find out contents of the
file, however, I guess that these files may have information such as
lat/long, sequence of grids, etc. related to data.  I like to confirm
with you that what ever is there in .grib.indeix that is still
applicable for the files created from 1(ii) as grid information is not
changed. Please confirm.


Thanks much,
Satish


On 12/17/2010 6:17 PM, RAL HelpDesk {for John Halley Gotway} wrote:
> Satish,
>
> My responses are inline...
>
> On 12/14/2010 03:00 PM, RAL HelpDesk {for Satish Regonda} wrote:
>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
>>
>> Dear John Halley Gotway,
>>     This helps a lot. Figures made me to understand easily. I have
few
>> questions and request you provide some light on the same. Also,
request
>> you to correct me if I am wrong on the following.
>>
>> 1. wgrib -d 360 -grib -o land_mask.grb
nam_218_20101210_0000_012.grb
>>      Record 360 corresponds to land mass and the above commands
pulls out
>> all the information corresponding to land mass (of North America).
This
>> information will be having lat/long information as well and is
supplied
>> to copygb. Please confirm. If it so, how can I pull out information
that
>> corresponds to CONUS? I believe supplying lat-long information of
CONUS
>> in a grib file via copygb provides solution to my problem.
>>
> Yes, this is correct.  "-d 360" tells copygb to only extract record
number 360 which does contain the record for "LAND" which is a 0/1
mask for where there's land versus water.  The lat/lon
> information is contained in the Grid Description Section (GDS)
section of each GRIB record.  To my knowledge, there isn't a way of
providing lat/lon's to use to subset the domain.
>
>> 2. 'copygb' command reads lat/long information from a file that is
>> followed by -B and then reads data corresponds to this region from
input
>> file, and then writes into output file. If this is so, the
following
>> command should do the job for me. Please confirm.
>>    copygv -x -B conus_lat_long_file inputfile.grib outputfile.grib
>>
>>     As you mentioned it is not necessary that files entitled
>> "conus_lat_long_file" and  "inputfile.grib" not necessarily on the
same
>> grid scale.
>>
> Yes, that's true "conus_lat_long_file" and "inputfile.grib" do not
need to be on the same grid.  However, I believe your
"conus_lat_long_file" has to be a GRIB file.
>
>
>
>> 3. You did use option  -A '>0', does it retain values only that are
>> greater than "0"?
> Yes, in that example listed below, "-A '>0'" tells copygb to only
use the grid points where the file land_mask.grb has a value greater
than 0.
>    copygb -x -B land_mask.grb -A '>0' nam_218_20101210_0000_012.grb
nam_over_land.grb
>
>> 4. I ran the following command, and I believe that it masks
landmass
>> region. The file size decreased from 51M to 6.1 M. I ran "wgrib -V"
for
>> the first record of two files and from outset it looks like the
same
>> Gaussian grid maintained in two files. one variable "bitmap: 68724
>> undef" is added but am not sure what is it.
>>
>>   copygb -x -B land_mask.grb test.grib test_land_maks.grib
>>
>>
>> $ wgrib -V test.grib -d 0
>> rec 1:0:date 1999010100 PRATE kpds5=59 kpds6=1 kpds7=0 levels=(0,0)
>> grid=126 sfc 6hr fcst:
>>    PRATE=Precipitation rate [kg/m^2/s]
>>    timerange 10 P1 0 P2 6 TimeU 1  nx 384 ny 190 GDS grid 4
num_in_ave 0
>> missing 0
>>    center 7 subcenter 0 process 82 Table 2 scan: WE:NS winds(N/S)
>>    gaussian: lat  89.277000 to -89.277000
>>              long 0.000000 to -0.938000 by 0.938000, (384 x 190)
scan 0
>> mode 128 bdsgrid 1
>>    min/max data 0 0.002421  num bits 12  BDS_Ref 0  DecScale 6
BinScale 0
>>
>> $  wgrib -V test_land_maks.grib  -d 0
>> rec 1:4:date 1999010100 PRATE kpds5=59 kpds6=1 kpds7=0 levels=(0,0)
>> grid=126 sfc 6hr fcst: bitmap: 68724 undef
>>    PRATE=Precipitation rate [kg/m^2/s]
>>    timerange 10 P1 0 P2 6 TimeU 1  nx 384 ny 190 GDS grid 4
num_in_ave 0
>> missing 0
>>    center 7 subcenter 0 process 82 Table 2 scan: WE:NS winds(N/S)
>>    gaussian: lat  89.277000 to -89.277000
>>              long 0.000000 to -0.938000 by 0.938000, (384 x 190)
scan 0
>> mode 128 bdsgrid 1
>>    min/max data 0 0.00057  num bits 10  BDS_Ref 0  DecScale 6
BinScale 0
>>
> When you do the masking using the "-B" option, the grid definitions
will remain unchanged.  Remember, this isn't regridding the data, it's
just masking it out.  However, when you look at the file
> sizes before and after, the one after the masking should be smaller.
>
>> 6. regridding using the "-g" option: Having grid that covers CONUS
>> region @ Gaussian scale makes my problem simple. I did look into
the
>> table but did not find the grid. If you know any information on
this
>> kindly let me know.
> This is what I'm trying to tell you.  There is no predefined grid
you should use.  Instead, you should define your own grid
specification that matches closely with the CONUS subset you'd like to
use.
>   Please look at the following website for an example of defining
your own custom grid:
>
http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/run2.php
>
> Just look at the example on that page, and try to define your own
grid that makes sense for your data.
>
> Hope that helps.
>
> John Halley Gotway
>
>>     Greatly appreciate your answers/suggestions.
>> Thanks much,
>> Satish
>>
>> ----- Original Message -----
>> From: RAL HelpDesk {for John Halley Gotway}<met_help at ucar.edu>
>> Date: Tuesday, December 14, 2010 1:49 pm
>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
region
>> (ggrib,copygb)
>>
>>> Satish,
>>>
>>> Actually, the masking does in fact reduce the file size.  Here are
>>> the sizes for the files who's picture I sent:
>>>
>>> -rw-r--r-- 1 johnhg rap4  32M 2010-12-10 00:04
>>> gfs_3_20101210_0000_012.grb-rwxr-xr-x 1 johnhg rap4 4.4M 2010-12-
14
>>> 10:03 gfs_masked_by_nam.grb*
>>> -rw-r--r-- 1 johnhg rap4 118M 2010-12-10 00:15
>>> nam_218_20101210_0000_012.grb-rwxr-xr-x 1 johnhg rap4  51M 2010-
12-
>>> 14 09:58 nam_over_land.grb*
>>>
>>> The GFS reduced in size from 32M down to 4.4M when masking over
>>> CONUS.  And the NAM reduced in size from 118M down to 51M when
>>> masking over land.
>>>
>>> copygb does in fact throw away that data is isn't using.  It
stores
>>> a 0/1 bitmap field to define where it does/does not have data.  It
>>> only stores the data values where the bitmap is set to 1.
>>>
>>> So masking the data may in fact be a reasonable way of reducing
the
>>> file size.  Of course, regridding it using the "-g" option of
>>> copygb would work too.
>>>
>>> John
>>>
>>>
>>> On 12/14/2010 11:15 AM, RAL HelpDesk {for Satish Regonda} wrote:
>>>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
>>>>
>>>> Dear John Halley Gotway,
>>>>     Thanks very much for the detailed useful information.
>>>>     You got it what I want to do, i.e., extract information for a
>>> smaller>  regions with out any interpolation. I am in the process
of
>>> downloading>  CFSV2 hindcasts and as you know these require a lot
of
>>> storage space and
>>>> am hoping extracting data on to CONUS region greatly decrease
>>> storage>  requirements.'mask' option does not offer much help as
it
>>> keeps the
>>>> entire data in the file.
>>>>     I have already gone through the tutorial that you mentioned
>>> and felt
>>>> "Interpolate to a pre-defined NCEP grid" will be useful. My
>>> gribdata is
>>>> on Gaussian grid, as per the table the value is 126. So, a pre-
>>> defined>  grid that corresponds to CONUS region with Gaussian T126
>>> grid will solve
>>>> my problem but did not find the same in the list of the pre-
>>> defined NCEP
>>>> grids (http://www.nco.ncep.noaa.gov/pmb/docs/on388/tableb.html).
>>>>     ggrib is one of the ncep products
>>>> (http://www.cpc.ncep.noaa.gov/products/wesley/ggrib.html), if
>>> this works
>>>> my problem solved but is not working for me.
>>>>
>>>>       Kindly let me know your suggestions.
>>>> Thanks much
>>>> Satish
>>>>
>>>>
>>>>
>>>>
>>>> ----- Original Message -----
>>>> From: RAL HelpDesk {for John Halley Gotway}<met_help at ucar.edu>
>>>> Date: Tuesday, December 14, 2010 12:06 pm
>>>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
>>> region>  (ggrib,copygb)
>>>>> Satish,
>>>>>
>>>>> First, I'm not familiar with ggrib - we only really use copygb
>>> here.>>
>>>>> So I understand that you'd like to create a subset of a GRIB
>>> record
>>>>> without actually interpolating it.  The short answer is that I
>>> do
>>>>> not know how to do that directly.
>>>>>
>>>>> I believe that if you'd like to only look at a subset of the
>>> data
>>>>> that would by definition change how the grid is defined.  For
>>>>> example, if you want to reduce the number of grid point you're
>>> look
>>>>> at -
>>>>> say from 360x180 down to 100x100 - that would change the grid
>>>>> definition.  And you'd need to regrid using the "-g" option in
>>>>> copygb to do that regridding.  However, if you just want to
>>> "mask"
>>>>> out a
>>>>> subset of the data in your input file you do have some options.
>>>>>
>>>>> So here are some things you may want to consider trying:
>>>>>
>>>>> (1) First, you could create a user-defined grid to regrid your
>>> data
>>>>> using the "-g" option.  We've included some examples in the MET
>>>>> online tutorial describing how to do this:
>>>>>
>>>>>
>>
http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/index.phpJust>
>> click on the forward arrow to advance through the pages.  If you
choose
>>>> a grid who's grid points are very similar to the input grid, the
>>> effect>  of interpolating will be very minimal.  For a
>>>>> lat/lon grid, you should be able to define an exact subset.  For
>>>>> other projections, that'd be more difficult.
>>>>>
>>>>> (2) If you're using this GRIB data as input to the MET tools,
>>> you
>>>>> could just leave the data on it's native domain.  And then in
>>> MET,
>>>>> you can using the "mask_grid" and "mask_poly" options in the
>>>>> configuration files to define the subsets of the grid over which
>>>>> you'd like to perform the verification.
>>>>>
>>>>> (3) You can use copygb to "mask out" subsets of your domain in
>>>>> which your interested.  Please note, this will NOT regrid the
>>> data,
>>>>> just mask it out on it's native grid.  Here are some examples:
>>>>>    # Retrieve a sample NAM file
>>>>>    wget http://nomads.ncdc.noaa.gov/data/meso-eta-
>>>>> hi/201012/20101210/nam_218_20101210_0000_012.grb
>>>>>    # Use wgrib to pull out the record for the land mask
>>>>>    wgrib -d 360 -grib -o land_mask.grb
nam_218_20101210_0000_012.grb
>>>>>
>>>>>    # Use copygb to mask out the NAM data only over land
>>>>>    # The -B option defines the masking region and the -A option
>>>>> defines a threshold to be applied to that field
>>>>>    copygb -x -B land_mask.grb -A '>0'
>>> nam_218_20101210_0000_012.grb
>>>>> nam_over_land.grb
>>>>>    Attached you can see picture of the NAM data before the
>>> masking
>>>>> and after the masking.  These were created using the IDV tool.
>>>>>
>>>>> (4) Also, please note that the masking region does not need to
>>> be
>>>>> on the same grid as the input region.  For example:
>>>>>    # Retrieve a GFS file
>>>>>    wget http://nomads.ncdc.noaa.gov/data/gfs-avn-
>>>>> hi/201012/20101210/gfs_3_20101210_0000_012.grb
>>>>>    # Mask out the GFS data only over the NAM domain
>>>>>    copygb -x -B nam_218_20101210_0000_012.grb
>>>>> gfs_3_20101210_0000_012.grb gfs_masked_by_nam.grb
>>>>>
>>>>>    Again, I've attached images of the GFS data before and after
>>>>> this masking operation.  But note that this has not actually
>>>>> changed the definition of the grid - just where the data is
valid.
>>>>>
>>>>> Hope that helps.
>>>>>
>>>>> Thanks,
>>>>> John Halley Gotway
>>>>>
>>>>> On 12/14/2010 09:23 AM, RAL HelpDesk {for Satish Regonda} wrote:
>>>>>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
>>>>>>
>>>>>>
>>>>>> Dear John Halley Gotway,
>>>>>>     I did register. Kindly let me know if you need any
additional
>>>>>> information.
>>>>>> thanks much,
>>>>>> Satish
>>>>>>
>>>>>> ----- Original Message -----
>>>>>> From: RAL HelpDesk {for John Halley Gotway}<met_help at ucar.edu>
>>>>>> Date: Tuesday, December 14, 2010 11:18 am
>>>>>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a
>>> smaller
>>>>> region>  (ggrib,copygb)
>>>>>>> Satish,
>>>>>>>
>>>>>>> We are not able to offer direct support to users who have not
>>>>> yet
>>>>>>> registered on the MET website.  We do this to ensure that we
>>>>> remain
>>>>>>> in compliance with the international export laws of the United
>>>>>>> States.
>>>>>>>
>>>>>>> To fill out the free registration, please go here:
>>>>>>>    http://www.dtcenter.org/met/users/downloads/index.php
>>>>>>>
>>>>>>> Enter your email address in the box and hit enter.  That'll
>>> take
>>>>>>> you to the registration page.
>>>>>>>
>>>>>>> Please write us back to let us know when you've registered.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> John Halley Gotway
>>>>>>> met_help at ucar.edu
>>>>>>>
>>>>>>> On 12/14/2010 08:26 AM, RAL HelpDesk {for Satish Regonda}
wrote:
>>>>>>>> Tue Dec 14 08:26:56 2010: Request 42754 was acted upon.
>>>>>>>> Transaction: Ticket created by Satish.Regonda at noaa.gov
>>>>>>>>         Queue: met_help
>>>>>>>>       Subject: copy GRIBdata for a smaller region
(ggrib,copygb)
>>>>>>>>         Owner: Nobody
>>>>>>>>    Requestors: Satish.Regonda at noaa.gov
>>>>>>>>        Status: new
>>>>>>>>   Ticket<URL:
>>>>>>> https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>      I like to extract data from a grib file for a smaller
>>>>> region
>>>>>>> (e.g.,
>>>>>>>> CONUS) on its native grid; I do not want to do  any
>>>>>>> interpolation. I
>>>>>>>> understood that copygb and ggrib will do the job but unable
>>> to
>>>>>>> figure out.
>>>>>>>> 1. copygb options,  "-B" and "-g" (grid= -1 yields output
>>> grid
>>>>> as
>>>>>>> input
>>>>>>>> grid), might do the job but did not find any guidelines to
>>> pass
>>>>>>> lat and
>>>>>>>> long information of a region that I want to extract the data
>>>>>>>> 2. ggrib should do the job but when I executed the following
>>>>>>> messaged
>>>>>>>> displayed.
>>>>>>>>
>>>>>>>> $ ggrib test.grib conus_test.grib -130 25 -50 55
>>>>>>>> ERROR: Grid #   1 not in geographic coordinates (lon,lat),
>>> exiting>>>>>
>>>>>>>> Any help is greatly appreciated.
>>>>>>>> Thanks much,
>>>>>>>> Satish
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>
>>>

------------------------------------------------
Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller region (ggrib,copygb)
From: Paul Oldenburg
Time: Wed Dec 22 14:05:36 2010

John,

I'm not sure how to answer this user's questions.  It seems like you
were already engaged with him.  Maybe he can wait
until the 3rd.

Paul

On 12/22/2010 11:27 AM, RAL HelpDesk {for Satish Regonda} wrote:
>
> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
>
> John,
>     Thanks for all the information and it is very helpful. I have
two
> more questions and request you to to provide information
>
> 1.  File entitled "test.grib" have the data on Gaussian grid for the
> entire world.
>
>     (i). ran copygb on a customized grid that corresponds to CONUS
> region, i.e., 20N-55N,130w-45w
>
>     $ grid='255 0 201 201 20000 230000 128 55000 315000 100 100 64'
>     $ copygb -g"$grid" -x test.grib test_conus.grib
>
>          I believe that "test_conus.grib" will have lat and long
> correspond to CONUS and data interpolated from it's native
(Gaussian)
> grid to the above mentioned customized grid.
>
>     ii.  ran copygb command as below mentioned with "-B" option.
>
>     $ copygb -x -B test_conus.grib test.grib
test_conus_gaussian.grib
>
>          As you mentioned, the above command masks the data without
> changing grid boundary definition. Therefore,
"test_conus_gaussian.grib"
> will have data only corresponds to CONUS region on it's native grid.
I
> ran wgrib -V command on both files, i.e., "test.grib" and
> "test_conus_gaussian.grib". The summary looked almost same except
some
> part of the text. I am not sure what does it reflects though. In
this
> regard, to make sure every thing is working fine I like to compare
data
> corresponds to the CONUS region from the two files.  is it possible
to
> do this? Greatly appreciate your suggestions.
>
> 2. I also have .grib.index files. I need to find out contents of the
> file, however, I guess that these files may have information such as
> lat/long, sequence of grids, etc. related to data.  I like to
confirm
> with you that what ever is there in .grib.indeix that is still
> applicable for the files created from 1(ii) as grid information is
not
> changed. Please confirm.
>
>
> Thanks much,
> Satish
>
>
> On 12/17/2010 6:17 PM, RAL HelpDesk {for John Halley Gotway} wrote:
>> Satish,
>>
>> My responses are inline...
>>
>> On 12/14/2010 03:00 PM, RAL HelpDesk {for Satish Regonda} wrote:
>>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
>>>
>>> Dear John Halley Gotway,
>>>     This helps a lot. Figures made me to understand easily. I have
few
>>> questions and request you provide some light on the same. Also,
request
>>> you to correct me if I am wrong on the following.
>>>
>>> 1. wgrib -d 360 -grib -o land_mask.grb
nam_218_20101210_0000_012.grb
>>>      Record 360 corresponds to land mass and the above commands
pulls out
>>> all the information corresponding to land mass (of North America).
This
>>> information will be having lat/long information as well and is
supplied
>>> to copygb. Please confirm. If it so, how can I pull out
information that
>>> corresponds to CONUS? I believe supplying lat-long information of
CONUS
>>> in a grib file via copygb provides solution to my problem.
>>>
>> Yes, this is correct.  "-d 360" tells copygb to only extract record
number 360 which does contain the record for "LAND" which is a 0/1
mask for where there's land versus water.  The lat/lon
>> information is contained in the Grid Description Section (GDS)
section of each GRIB record.  To my knowledge, there isn't a way of
providing lat/lon's to use to subset the domain.
>>
>>> 2. 'copygb' command reads lat/long information from a file that is
>>> followed by -B and then reads data corresponds to this region from
input
>>> file, and then writes into output file. If this is so, the
following
>>> command should do the job for me. Please confirm.
>>>    copygv -x -B conus_lat_long_file inputfile.grib outputfile.grib
>>>
>>>     As you mentioned it is not necessary that files entitled
>>> "conus_lat_long_file" and  "inputfile.grib" not necessarily on the
same
>>> grid scale.
>>>
>> Yes, that's true "conus_lat_long_file" and "inputfile.grib" do not
need to be on the same grid.  However, I believe your
"conus_lat_long_file" has to be a GRIB file.
>>
>>
>>
>>> 3. You did use option  -A '>0', does it retain values only that
are
>>> greater than "0"?
>> Yes, in that example listed below, "-A '>0'" tells copygb to only
use the grid points where the file land_mask.grb has a value greater
than 0.
>>    copygb -x -B land_mask.grb -A '>0' nam_218_20101210_0000_012.grb
nam_over_land.grb
>>
>>> 4. I ran the following command, and I believe that it masks
landmass
>>> region. The file size decreased from 51M to 6.1 M. I ran "wgrib
-V" for
>>> the first record of two files and from outset it looks like the
same
>>> Gaussian grid maintained in two files. one variable "bitmap: 68724
>>> undef" is added but am not sure what is it.
>>>
>>>   copygb -x -B land_mask.grb test.grib test_land_maks.grib
>>>
>>>
>>> $ wgrib -V test.grib -d 0
>>> rec 1:0:date 1999010100 PRATE kpds5=59 kpds6=1 kpds7=0
levels=(0,0)
>>> grid=126 sfc 6hr fcst:
>>>    PRATE=Precipitation rate [kg/m^2/s]
>>>    timerange 10 P1 0 P2 6 TimeU 1  nx 384 ny 190 GDS grid 4
num_in_ave 0
>>> missing 0
>>>    center 7 subcenter 0 process 82 Table 2 scan: WE:NS winds(N/S)
>>>    gaussian: lat  89.277000 to -89.277000
>>>              long 0.000000 to -0.938000 by 0.938000, (384 x 190)
scan 0
>>> mode 128 bdsgrid 1
>>>    min/max data 0 0.002421  num bits 12  BDS_Ref 0  DecScale 6
BinScale 0
>>>
>>> $  wgrib -V test_land_maks.grib  -d 0
>>> rec 1:4:date 1999010100 PRATE kpds5=59 kpds6=1 kpds7=0
levels=(0,0)
>>> grid=126 sfc 6hr fcst: bitmap: 68724 undef
>>>    PRATE=Precipitation rate [kg/m^2/s]
>>>    timerange 10 P1 0 P2 6 TimeU 1  nx 384 ny 190 GDS grid 4
num_in_ave 0
>>> missing 0
>>>    center 7 subcenter 0 process 82 Table 2 scan: WE:NS winds(N/S)
>>>    gaussian: lat  89.277000 to -89.277000
>>>              long 0.000000 to -0.938000 by 0.938000, (384 x 190)
scan 0
>>> mode 128 bdsgrid 1
>>>    min/max data 0 0.00057  num bits 10  BDS_Ref 0  DecScale 6
BinScale 0
>>>
>> When you do the masking using the "-B" option, the grid definitions
will remain unchanged.  Remember, this isn't regridding the data, it's
just masking it out.  However, when you look at the file
>> sizes before and after, the one after the masking should be
smaller.
>>
>>> 6. regridding using the "-g" option: Having grid that covers CONUS
>>> region @ Gaussian scale makes my problem simple. I did look into
the
>>> table but did not find the grid. If you know any information on
this
>>> kindly let me know.
>> This is what I'm trying to tell you.  There is no predefined grid
you should use.  Instead, you should define your own grid
specification that matches closely with the CONUS subset you'd like to
use.
>>   Please look at the following website for an example of defining
your own custom grid:
>>
http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/run2.php
>>
>> Just look at the example on that page, and try to define your own
grid that makes sense for your data.
>>
>> Hope that helps.
>>
>> John Halley Gotway
>>
>>>     Greatly appreciate your answers/suggestions.
>>> Thanks much,
>>> Satish
>>>
>>> ----- Original Message -----
>>> From: RAL HelpDesk {for John Halley Gotway}<met_help at ucar.edu>
>>> Date: Tuesday, December 14, 2010 1:49 pm
>>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
region
>>> (ggrib,copygb)
>>>
>>>> Satish,
>>>>
>>>> Actually, the masking does in fact reduce the file size.  Here
are
>>>> the sizes for the files who's picture I sent:
>>>>
>>>> -rw-r--r-- 1 johnhg rap4  32M 2010-12-10 00:04
>>>> gfs_3_20101210_0000_012.grb-rwxr-xr-x 1 johnhg rap4 4.4M 2010-12-
14
>>>> 10:03 gfs_masked_by_nam.grb*
>>>> -rw-r--r-- 1 johnhg rap4 118M 2010-12-10 00:15
>>>> nam_218_20101210_0000_012.grb-rwxr-xr-x 1 johnhg rap4  51M 2010-
12-
>>>> 14 09:58 nam_over_land.grb*
>>>>
>>>> The GFS reduced in size from 32M down to 4.4M when masking over
>>>> CONUS.  And the NAM reduced in size from 118M down to 51M when
>>>> masking over land.
>>>>
>>>> copygb does in fact throw away that data is isn't using.  It
stores
>>>> a 0/1 bitmap field to define where it does/does not have data.
It
>>>> only stores the data values where the bitmap is set to 1.
>>>>
>>>> So masking the data may in fact be a reasonable way of reducing
the
>>>> file size.  Of course, regridding it using the "-g" option of
>>>> copygb would work too.
>>>>
>>>> John
>>>>
>>>>
>>>> On 12/14/2010 11:15 AM, RAL HelpDesk {for Satish Regonda} wrote:
>>>>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
>>>>>
>>>>> Dear John Halley Gotway,
>>>>>     Thanks very much for the detailed useful information.
>>>>>     You got it what I want to do, i.e., extract information for
a
>>>> smaller>  regions with out any interpolation. I am in the process
of
>>>> downloading>  CFSV2 hindcasts and as you know these require a lot
of
>>>> storage space and
>>>>> am hoping extracting data on to CONUS region greatly decrease
>>>> storage>  requirements.'mask' option does not offer much help as
it
>>>> keeps the
>>>>> entire data in the file.
>>>>>     I have already gone through the tutorial that you mentioned
>>>> and felt
>>>>> "Interpolate to a pre-defined NCEP grid" will be useful. My
>>>> gribdata is
>>>>> on Gaussian grid, as per the table the value is 126. So, a pre-
>>>> defined>  grid that corresponds to CONUS region with Gaussian
T126
>>>> grid will solve
>>>>> my problem but did not find the same in the list of the pre-
>>>> defined NCEP
>>>>> grids (http://www.nco.ncep.noaa.gov/pmb/docs/on388/tableb.html).
>>>>>     ggrib is one of the ncep products
>>>>> (http://www.cpc.ncep.noaa.gov/products/wesley/ggrib.html), if
>>>> this works
>>>>> my problem solved but is not working for me.
>>>>>
>>>>>       Kindly let me know your suggestions.
>>>>> Thanks much
>>>>> Satish
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ----- Original Message -----
>>>>> From: RAL HelpDesk {for John Halley Gotway}<met_help at ucar.edu>
>>>>> Date: Tuesday, December 14, 2010 12:06 pm
>>>>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a
smaller
>>>> region>  (ggrib,copygb)
>>>>>> Satish,
>>>>>>
>>>>>> First, I'm not familiar with ggrib - we only really use copygb
>>>> here.>>
>>>>>> So I understand that you'd like to create a subset of a GRIB
>>>> record
>>>>>> without actually interpolating it.  The short answer is that I
>>>> do
>>>>>> not know how to do that directly.
>>>>>>
>>>>>> I believe that if you'd like to only look at a subset of the
>>>> data
>>>>>> that would by definition change how the grid is defined.  For
>>>>>> example, if you want to reduce the number of grid point you're
>>>> look
>>>>>> at -
>>>>>> say from 360x180 down to 100x100 - that would change the grid
>>>>>> definition.  And you'd need to regrid using the "-g" option in
>>>>>> copygb to do that regridding.  However, if you just want to
>>>> "mask"
>>>>>> out a
>>>>>> subset of the data in your input file you do have some options.
>>>>>>
>>>>>> So here are some things you may want to consider trying:
>>>>>>
>>>>>> (1) First, you could create a user-defined grid to regrid your
>>>> data
>>>>>> using the "-g" option.  We've included some examples in the MET
>>>>>> online tutorial describing how to do this:
>>>>>>
>>>>>>
>>>
http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/index.phpJust>
>>> click on the forward arrow to advance through the pages.  If you
choose
>>>>> a grid who's grid points are very similar to the input grid, the
>>>> effect>  of interpolating will be very minimal.  For a
>>>>>> lat/lon grid, you should be able to define an exact subset.
For
>>>>>> other projections, that'd be more difficult.
>>>>>>
>>>>>> (2) If you're using this GRIB data as input to the MET tools,
>>>> you
>>>>>> could just leave the data on it's native domain.  And then in
>>>> MET,
>>>>>> you can using the "mask_grid" and "mask_poly" options in the
>>>>>> configuration files to define the subsets of the grid over
which
>>>>>> you'd like to perform the verification.
>>>>>>
>>>>>> (3) You can use copygb to "mask out" subsets of your domain in
>>>>>> which your interested.  Please note, this will NOT regrid the
>>>> data,
>>>>>> just mask it out on it's native grid.  Here are some examples:
>>>>>>    # Retrieve a sample NAM file
>>>>>>    wget http://nomads.ncdc.noaa.gov/data/meso-eta-
>>>>>> hi/201012/20101210/nam_218_20101210_0000_012.grb
>>>>>>    # Use wgrib to pull out the record for the land mask
>>>>>>    wgrib -d 360 -grib -o land_mask.grb
nam_218_20101210_0000_012.grb
>>>>>>
>>>>>>    # Use copygb to mask out the NAM data only over land
>>>>>>    # The -B option defines the masking region and the -A option
>>>>>> defines a threshold to be applied to that field
>>>>>>    copygb -x -B land_mask.grb -A '>0'
>>>> nam_218_20101210_0000_012.grb
>>>>>> nam_over_land.grb
>>>>>>    Attached you can see picture of the NAM data before the
>>>> masking
>>>>>> and after the masking.  These were created using the IDV tool.
>>>>>>
>>>>>> (4) Also, please note that the masking region does not need to
>>>> be
>>>>>> on the same grid as the input region.  For example:
>>>>>>    # Retrieve a GFS file
>>>>>>    wget http://nomads.ncdc.noaa.gov/data/gfs-avn-
>>>>>> hi/201012/20101210/gfs_3_20101210_0000_012.grb
>>>>>>    # Mask out the GFS data only over the NAM domain
>>>>>>    copygb -x -B nam_218_20101210_0000_012.grb
>>>>>> gfs_3_20101210_0000_012.grb gfs_masked_by_nam.grb
>>>>>>
>>>>>>    Again, I've attached images of the GFS data before and after
>>>>>> this masking operation.  But note that this has not actually
>>>>>> changed the definition of the grid - just where the data is
valid.
>>>>>>
>>>>>> Hope that helps.
>>>>>>
>>>>>> Thanks,
>>>>>> John Halley Gotway
>>>>>>
>>>>>> On 12/14/2010 09:23 AM, RAL HelpDesk {for Satish Regonda}
wrote:
>>>>>>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
>>>>>>>
>>>>>>>
>>>>>>> Dear John Halley Gotway,
>>>>>>>     I did register. Kindly let me know if you need any
additional
>>>>>>> information.
>>>>>>> thanks much,
>>>>>>> Satish
>>>>>>>
>>>>>>> ----- Original Message -----
>>>>>>> From: RAL HelpDesk {for John Halley Gotway}<met_help at ucar.edu>
>>>>>>> Date: Tuesday, December 14, 2010 11:18 am
>>>>>>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a
>>>> smaller
>>>>>> region>  (ggrib,copygb)
>>>>>>>> Satish,
>>>>>>>>
>>>>>>>> We are not able to offer direct support to users who have not
>>>>>> yet
>>>>>>>> registered on the MET website.  We do this to ensure that we
>>>>>> remain
>>>>>>>> in compliance with the international export laws of the
United
>>>>>>>> States.
>>>>>>>>
>>>>>>>> To fill out the free registration, please go here:
>>>>>>>>    http://www.dtcenter.org/met/users/downloads/index.php
>>>>>>>>
>>>>>>>> Enter your email address in the box and hit enter.  That'll
>>>> take
>>>>>>>> you to the registration page.
>>>>>>>>
>>>>>>>> Please write us back to let us know when you've registered.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> John Halley Gotway
>>>>>>>> met_help at ucar.edu
>>>>>>>>
>>>>>>>> On 12/14/2010 08:26 AM, RAL HelpDesk {for Satish Regonda}
wrote:
>>>>>>>>> Tue Dec 14 08:26:56 2010: Request 42754 was acted upon.
>>>>>>>>> Transaction: Ticket created by Satish.Regonda at noaa.gov
>>>>>>>>>         Queue: met_help
>>>>>>>>>       Subject: copy GRIBdata for a smaller region
(ggrib,copygb)
>>>>>>>>>         Owner: Nobody
>>>>>>>>>    Requestors: Satish.Regonda at noaa.gov
>>>>>>>>>        Status: new
>>>>>>>>>   Ticket<URL:
>>>>>>>> https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
>>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>      I like to extract data from a grib file for a smaller
>>>>>> region
>>>>>>>> (e.g.,
>>>>>>>>> CONUS) on its native grid; I do not want to do  any
>>>>>>>> interpolation. I
>>>>>>>>> understood that copygb and ggrib will do the job but unable
>>>> to
>>>>>>>> figure out.
>>>>>>>>> 1. copygb options,  "-B" and "-g" (grid= -1 yields output
>>>> grid
>>>>>> as
>>>>>>>> input
>>>>>>>>> grid), might do the job but did not find any guidelines to
>>>> pass
>>>>>>>> lat and
>>>>>>>>> long information of a region that I want to extract the data
>>>>>>>>> 2. ggrib should do the job but when I executed the following
>>>>>>>> messaged
>>>>>>>>> displayed.
>>>>>>>>>
>>>>>>>>> $ ggrib test.grib conus_test.grib -130 25 -50 55
>>>>>>>>> ERROR: Grid #   1 not in geographic coordinates (lon,lat),
>>>> exiting>>>>>
>>>>>>>>> Any help is greatly appreciated.
>>>>>>>>> Thanks much,
>>>>>>>>> Satish
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>
>>>>


------------------------------------------------
Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller region  (ggrib,copygb)
From: John Halley Gotway
Time: Wed Dec 22 14:16:31 2010

Satish,

I'm out of the office until January 3rd and am unable to run any
copygb
commands and offer you more guidance.  It sounds like you're wondering
about the effects of performing these regridding commands.

I'd strongly recommend that you plot the output of the copygb commands
so
you can see the effects yourself.  You can easily plot the GRIB data
using
one of the following options:

(1) Display it using the IDV tool (integrated data viewer):
   http://www.unidata.ucar.edu/software/idv/
This is a very nice display tool but takes some getting used to.
Please
refer to their online tutorial for a description of how to run it:
   http://www.unidata.ucar.edu/software/idv/docs/workshop/

(2) If you want to plot a GRIB file, you could just run it through the
MODE tool.  Just pass in the same file as the forecast and the
observation
- comparing the same field to itself.  MODE will great a postscript
plot
displaying the location of the data.

Please give this a shot.  If you continue to experience problems, feel
free to write us back on or after January 3rd.

Hope that helps.

Thanks,
John

>
> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
>
> John,
>     Thanks for all the information and it is very helpful. I have
two
> more questions and request you to to provide information
>
> 1.  File entitled "test.grib" have the data on Gaussian grid for the
> entire world.
>
>     (i). ran copygb on a customized grid that corresponds to CONUS
> region, i.e., 20N-55N,130w-45w
>
>     $ grid='255 0 201 201 20000 230000 128 55000 315000 100 100 64'
>     $ copygb -g"$grid" -x test.grib test_conus.grib
>
>          I believe that "test_conus.grib" will have lat and long
> correspond to CONUS and data interpolated from it's native
(Gaussian)
> grid to the above mentioned customized grid.
>
>     ii.  ran copygb command as below mentioned with "-B" option.
>
>     $ copygb -x -B test_conus.grib test.grib
test_conus_gaussian.grib
>
>          As you mentioned, the above command masks the data without
> changing grid boundary definition. Therefore,
"test_conus_gaussian.grib"
> will have data only corresponds to CONUS region on it's native grid.
I
> ran wgrib -V command on both files, i.e., "test.grib" and
> "test_conus_gaussian.grib". The summary looked almost same except
some
> part of the text. I am not sure what does it reflects though. In
this
> regard, to make sure every thing is working fine I like to compare
data
> corresponds to the CONUS region from the two files.  is it possible
to
> do this? Greatly appreciate your suggestions.
>
> 2. I also have .grib.index files. I need to find out contents of the
> file, however, I guess that these files may have information such as
> lat/long, sequence of grids, etc. related to data.  I like to
confirm
> with you that what ever is there in .grib.indeix that is still
> applicable for the files created from 1(ii) as grid information is
not
> changed. Please confirm.
>
>
> Thanks much,
> Satish
>
>
> On 12/17/2010 6:17 PM, RAL HelpDesk {for John Halley Gotway} wrote:
>> Satish,
>>
>> My responses are inline...
>>
>> On 12/14/2010 03:00 PM, RAL HelpDesk {for Satish Regonda} wrote:
>>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
>>>
>>> Dear John Halley Gotway,
>>>     This helps a lot. Figures made me to understand easily. I have
few
>>> questions and request you provide some light on the same. Also,
request
>>> you to correct me if I am wrong on the following.
>>>
>>> 1. wgrib -d 360 -grib -o land_mask.grb
nam_218_20101210_0000_012.grb
>>>      Record 360 corresponds to land mass and the above commands
pulls
>>> out
>>> all the information corresponding to land mass (of North America).
This
>>> information will be having lat/long information as well and is
supplied
>>> to copygb. Please confirm. If it so, how can I pull out
information
>>> that
>>> corresponds to CONUS? I believe supplying lat-long information of
CONUS
>>> in a grib file via copygb provides solution to my problem.
>>>
>> Yes, this is correct.  "-d 360" tells copygb to only extract record
>> number 360 which does contain the record for "LAND" which is a 0/1
mask
>> for where there's land versus water.  The lat/lon
>> information is contained in the Grid Description Section (GDS)
section
>> of each GRIB record.  To my knowledge, there isn't a way of
providing
>> lat/lon's to use to subset the domain.
>>
>>> 2. 'copygb' command reads lat/long information from a file that is
>>> followed by -B and then reads data corresponds to this region from
>>> input
>>> file, and then writes into output file. If this is so, the
following
>>> command should do the job for me. Please confirm.
>>>    copygv -x -B conus_lat_long_file inputfile.grib outputfile.grib
>>>
>>>     As you mentioned it is not necessary that files entitled
>>> "conus_lat_long_file" and  "inputfile.grib" not necessarily on the
same
>>> grid scale.
>>>
>> Yes, that's true "conus_lat_long_file" and "inputfile.grib" do not
need
>> to be on the same grid.  However, I believe your
"conus_lat_long_file"
>> has to be a GRIB file.
>>
>>
>>
>>> 3. You did use option  -A '>0', does it retain values only that
are
>>> greater than "0"?
>> Yes, in that example listed below, "-A '>0'" tells copygb to only
use
>> the grid points where the file land_mask.grb has a value greater
than 0.
>>    copygb -x -B land_mask.grb -A '>0' nam_218_20101210_0000_012.grb
>> nam_over_land.grb
>>
>>> 4. I ran the following command, and I believe that it masks
landmass
>>> region. The file size decreased from 51M to 6.1 M. I ran "wgrib
-V" for
>>> the first record of two files and from outset it looks like the
same
>>> Gaussian grid maintained in two files. one variable "bitmap: 68724
>>> undef" is added but am not sure what is it.
>>>
>>>   copygb -x -B land_mask.grb test.grib test_land_maks.grib
>>>
>>>
>>> $ wgrib -V test.grib -d 0
>>> rec 1:0:date 1999010100 PRATE kpds5=59 kpds6=1 kpds7=0
levels=(0,0)
>>> grid=126 sfc 6hr fcst:
>>>    PRATE=Precipitation rate [kg/m^2/s]
>>>    timerange 10 P1 0 P2 6 TimeU 1  nx 384 ny 190 GDS grid 4
num_in_ave
>>> 0
>>> missing 0
>>>    center 7 subcenter 0 process 82 Table 2 scan: WE:NS winds(N/S)
>>>    gaussian: lat  89.277000 to -89.277000
>>>              long 0.000000 to -0.938000 by 0.938000, (384 x 190)
scan 0
>>> mode 128 bdsgrid 1
>>>    min/max data 0 0.002421  num bits 12  BDS_Ref 0  DecScale 6
BinScale
>>> 0
>>>
>>> $  wgrib -V test_land_maks.grib  -d 0
>>> rec 1:4:date 1999010100 PRATE kpds5=59 kpds6=1 kpds7=0
levels=(0,0)
>>> grid=126 sfc 6hr fcst: bitmap: 68724 undef
>>>    PRATE=Precipitation rate [kg/m^2/s]
>>>    timerange 10 P1 0 P2 6 TimeU 1  nx 384 ny 190 GDS grid 4
num_in_ave
>>> 0
>>> missing 0
>>>    center 7 subcenter 0 process 82 Table 2 scan: WE:NS winds(N/S)
>>>    gaussian: lat  89.277000 to -89.277000
>>>              long 0.000000 to -0.938000 by 0.938000, (384 x 190)
scan 0
>>> mode 128 bdsgrid 1
>>>    min/max data 0 0.00057  num bits 10  BDS_Ref 0  DecScale 6
BinScale
>>> 0
>>>
>> When you do the masking using the "-B" option, the grid definitions
will
>> remain unchanged.  Remember, this isn't regridding the data, it's
just
>> masking it out.  However, when you look at the file
>> sizes before and after, the one after the masking should be
smaller.
>>
>>> 6. regridding using the "-g" option: Having grid that covers CONUS
>>> region @ Gaussian scale makes my problem simple. I did look into
the
>>> table but did not find the grid. If you know any information on
this
>>> kindly let me know.
>> This is what I'm trying to tell you.  There is no predefined grid
you
>> should use.  Instead, you should define your own grid specification
that
>> matches closely with the CONUS subset you'd like to use.
>>   Please look at the following website for an example of defining
your
>> own custom grid:
>>
http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/run2.php
>>
>> Just look at the example on that page, and try to define your own
grid
>> that makes sense for your data.
>>
>> Hope that helps.
>>
>> John Halley Gotway
>>
>>>     Greatly appreciate your answers/suggestions.
>>> Thanks much,
>>> Satish
>>>
>>> ----- Original Message -----
>>> From: RAL HelpDesk {for John Halley Gotway}<met_help at ucar.edu>
>>> Date: Tuesday, December 14, 2010 1:49 pm
>>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
>>> region
>>> (ggrib,copygb)
>>>
>>>> Satish,
>>>>
>>>> Actually, the masking does in fact reduce the file size.  Here
are
>>>> the sizes for the files who's picture I sent:
>>>>
>>>> -rw-r--r-- 1 johnhg rap4  32M 2010-12-10 00:04
>>>> gfs_3_20101210_0000_012.grb-rwxr-xr-x 1 johnhg rap4 4.4M 2010-12-
14
>>>> 10:03 gfs_masked_by_nam.grb*
>>>> -rw-r--r-- 1 johnhg rap4 118M 2010-12-10 00:15
>>>> nam_218_20101210_0000_012.grb-rwxr-xr-x 1 johnhg rap4  51M 2010-
12-
>>>> 14 09:58 nam_over_land.grb*
>>>>
>>>> The GFS reduced in size from 32M down to 4.4M when masking over
>>>> CONUS.  And the NAM reduced in size from 118M down to 51M when
>>>> masking over land.
>>>>
>>>> copygb does in fact throw away that data is isn't using.  It
stores
>>>> a 0/1 bitmap field to define where it does/does not have data.
It
>>>> only stores the data values where the bitmap is set to 1.
>>>>
>>>> So masking the data may in fact be a reasonable way of reducing
the
>>>> file size.  Of course, regridding it using the "-g" option of
>>>> copygb would work too.
>>>>
>>>> John
>>>>
>>>>
>>>> On 12/14/2010 11:15 AM, RAL HelpDesk {for Satish Regonda} wrote:
>>>>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
>>>>>
>>>>> Dear John Halley Gotway,
>>>>>     Thanks very much for the detailed useful information.
>>>>>     You got it what I want to do, i.e., extract information for
a
>>>> smaller>  regions with out any interpolation. I am in the process
of
>>>> downloading>  CFSV2 hindcasts and as you know these require a lot
of
>>>> storage space and
>>>>> am hoping extracting data on to CONUS region greatly decrease
>>>> storage>  requirements.'mask' option does not offer much help as
it
>>>> keeps the
>>>>> entire data in the file.
>>>>>     I have already gone through the tutorial that you mentioned
>>>> and felt
>>>>> "Interpolate to a pre-defined NCEP grid" will be useful. My
>>>> gribdata is
>>>>> on Gaussian grid, as per the table the value is 126. So, a pre-
>>>> defined>  grid that corresponds to CONUS region with Gaussian
T126
>>>> grid will solve
>>>>> my problem but did not find the same in the list of the pre-
>>>> defined NCEP
>>>>> grids (http://www.nco.ncep.noaa.gov/pmb/docs/on388/tableb.html).
>>>>>     ggrib is one of the ncep products
>>>>> (http://www.cpc.ncep.noaa.gov/products/wesley/ggrib.html), if
>>>> this works
>>>>> my problem solved but is not working for me.
>>>>>
>>>>>       Kindly let me know your suggestions.
>>>>> Thanks much
>>>>> Satish
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ----- Original Message -----
>>>>> From: RAL HelpDesk {for John Halley Gotway}<met_help at ucar.edu>
>>>>> Date: Tuesday, December 14, 2010 12:06 pm
>>>>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a
smaller
>>>> region>  (ggrib,copygb)
>>>>>> Satish,
>>>>>>
>>>>>> First, I'm not familiar with ggrib - we only really use copygb
>>>> here.>>
>>>>>> So I understand that you'd like to create a subset of a GRIB
>>>> record
>>>>>> without actually interpolating it.  The short answer is that I
>>>> do
>>>>>> not know how to do that directly.
>>>>>>
>>>>>> I believe that if you'd like to only look at a subset of the
>>>> data
>>>>>> that would by definition change how the grid is defined.  For
>>>>>> example, if you want to reduce the number of grid point you're
>>>> look
>>>>>> at -
>>>>>> say from 360x180 down to 100x100 - that would change the grid
>>>>>> definition.  And you'd need to regrid using the "-g" option in
>>>>>> copygb to do that regridding.  However, if you just want to
>>>> "mask"
>>>>>> out a
>>>>>> subset of the data in your input file you do have some options.
>>>>>>
>>>>>> So here are some things you may want to consider trying:
>>>>>>
>>>>>> (1) First, you could create a user-defined grid to regrid your
>>>> data
>>>>>> using the "-g" option.  We've included some examples in the MET
>>>>>> online tutorial describing how to do this:
>>>>>>
>>>>>>
>>>
http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/index.phpJust>
>>> click on the forward arrow to advance through the pages.  If you
choose
>>>>> a grid who's grid points are very similar to the input grid, the
>>>> effect>  of interpolating will be very minimal.  For a
>>>>>> lat/lon grid, you should be able to define an exact subset.
For
>>>>>> other projections, that'd be more difficult.
>>>>>>
>>>>>> (2) If you're using this GRIB data as input to the MET tools,
>>>> you
>>>>>> could just leave the data on it's native domain.  And then in
>>>> MET,
>>>>>> you can using the "mask_grid" and "mask_poly" options in the
>>>>>> configuration files to define the subsets of the grid over
which
>>>>>> you'd like to perform the verification.
>>>>>>
>>>>>> (3) You can use copygb to "mask out" subsets of your domain in
>>>>>> which your interested.  Please note, this will NOT regrid the
>>>> data,
>>>>>> just mask it out on it's native grid.  Here are some examples:
>>>>>>    # Retrieve a sample NAM file
>>>>>>    wget http://nomads.ncdc.noaa.gov/data/meso-eta-
>>>>>> hi/201012/20101210/nam_218_20101210_0000_012.grb
>>>>>>    # Use wgrib to pull out the record for the land mask
>>>>>>    wgrib -d 360 -grib -o land_mask.grb
nam_218_20101210_0000_012.grb
>>>>>>
>>>>>>    # Use copygb to mask out the NAM data only over land
>>>>>>    # The -B option defines the masking region and the -A option
>>>>>> defines a threshold to be applied to that field
>>>>>>    copygb -x -B land_mask.grb -A '>0'
>>>> nam_218_20101210_0000_012.grb
>>>>>> nam_over_land.grb
>>>>>>    Attached you can see picture of the NAM data before the
>>>> masking
>>>>>> and after the masking.  These were created using the IDV tool.
>>>>>>
>>>>>> (4) Also, please note that the masking region does not need to
>>>> be
>>>>>> on the same grid as the input region.  For example:
>>>>>>    # Retrieve a GFS file
>>>>>>    wget http://nomads.ncdc.noaa.gov/data/gfs-avn-
>>>>>> hi/201012/20101210/gfs_3_20101210_0000_012.grb
>>>>>>    # Mask out the GFS data only over the NAM domain
>>>>>>    copygb -x -B nam_218_20101210_0000_012.grb
>>>>>> gfs_3_20101210_0000_012.grb gfs_masked_by_nam.grb
>>>>>>
>>>>>>    Again, I've attached images of the GFS data before and after
>>>>>> this masking operation.  But note that this has not actually
>>>>>> changed the definition of the grid - just where the data is
valid.
>>>>>>
>>>>>> Hope that helps.
>>>>>>
>>>>>> Thanks,
>>>>>> John Halley Gotway
>>>>>>
>>>>>> On 12/14/2010 09:23 AM, RAL HelpDesk {for Satish Regonda}
wrote:
>>>>>>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
>>>>>>>
>>>>>>>
>>>>>>> Dear John Halley Gotway,
>>>>>>>     I did register. Kindly let me know if you need any
additional
>>>>>>> information.
>>>>>>> thanks much,
>>>>>>> Satish
>>>>>>>
>>>>>>> ----- Original Message -----
>>>>>>> From: RAL HelpDesk {for John Halley Gotway}<met_help at ucar.edu>
>>>>>>> Date: Tuesday, December 14, 2010 11:18 am
>>>>>>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a
>>>> smaller
>>>>>> region>  (ggrib,copygb)
>>>>>>>> Satish,
>>>>>>>>
>>>>>>>> We are not able to offer direct support to users who have not
>>>>>> yet
>>>>>>>> registered on the MET website.  We do this to ensure that we
>>>>>> remain
>>>>>>>> in compliance with the international export laws of the
United
>>>>>>>> States.
>>>>>>>>
>>>>>>>> To fill out the free registration, please go here:
>>>>>>>>    http://www.dtcenter.org/met/users/downloads/index.php
>>>>>>>>
>>>>>>>> Enter your email address in the box and hit enter.  That'll
>>>> take
>>>>>>>> you to the registration page.
>>>>>>>>
>>>>>>>> Please write us back to let us know when you've registered.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> John Halley Gotway
>>>>>>>> met_help at ucar.edu
>>>>>>>>
>>>>>>>> On 12/14/2010 08:26 AM, RAL HelpDesk {for Satish Regonda}
wrote:
>>>>>>>>> Tue Dec 14 08:26:56 2010: Request 42754 was acted upon.
>>>>>>>>> Transaction: Ticket created by Satish.Regonda at noaa.gov
>>>>>>>>>         Queue: met_help
>>>>>>>>>       Subject: copy GRIBdata for a smaller region
(ggrib,copygb)
>>>>>>>>>         Owner: Nobody
>>>>>>>>>    Requestors: Satish.Regonda at noaa.gov
>>>>>>>>>        Status: new
>>>>>>>>>   Ticket<URL:
>>>>>>>> https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
>>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>      I like to extract data from a grib file for a smaller
>>>>>> region
>>>>>>>> (e.g.,
>>>>>>>>> CONUS) on its native grid; I do not want to do  any
>>>>>>>> interpolation. I
>>>>>>>>> understood that copygb and ggrib will do the job but unable
>>>> to
>>>>>>>> figure out.
>>>>>>>>> 1. copygb options,  "-B" and "-g" (grid= -1 yields output
>>>> grid
>>>>>> as
>>>>>>>> input
>>>>>>>>> grid), might do the job but did not find any guidelines to
>>>> pass
>>>>>>>> lat and
>>>>>>>>> long information of a region that I want to extract the data
>>>>>>>>> 2. ggrib should do the job but when I executed the following
>>>>>>>> messaged
>>>>>>>>> displayed.
>>>>>>>>>
>>>>>>>>> $ ggrib test.grib conus_test.grib -130 25 -50 55
>>>>>>>>> ERROR: Grid #   1 not in geographic coordinates (lon,lat),
>>>> exiting>>>>>
>>>>>>>>> Any help is greatly appreciated.
>>>>>>>>> Thanks much,
>>>>>>>>> Satish
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>
>>>>
>



------------------------------------------------
Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller region (ggrib,copygb)
From: Satish Regonda
Time: Wed Dec 22 14:24:25 2010

John,
  I think what you suggested may work for me. I will try and write to
you on or after Jan 3rd.
Thanks much,
Satish


----- Original Message -----
From: RAL HelpDesk {for John Halley Gotway} <met_help at ucar.edu>
Date: Wednesday, December 22, 2010 4:16 pm
Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a smaller
region
(ggrib,copygb)

> Satish,
>
> I'm out of the office until January 3rd and am unable to run any
> copygbcommands and offer you more guidance.  It sounds like you're
> wonderingabout the effects of performing these regridding commands.
>
> I'd strongly recommend that you plot the output of the copygb
> commands so
> you can see the effects yourself.  You can easily plot the GRIB
> data using
> one of the following options:
>
> (1) Display it using the IDV tool (integrated data viewer):
>   http://www.unidata.ucar.edu/software/idv/
> This is a very nice display tool but takes some getting used to.
> Pleaserefer to their online tutorial for a description of how to
> run it:
>   http://www.unidata.ucar.edu/software/idv/docs/workshop/
>
> (2) If you want to plot a GRIB file, you could just run it through
the
> MODE tool.  Just pass in the same file as the forecast and the
> observation- comparing the same field to itself.  MODE will great a
> postscript plot
> displaying the location of the data.
>
> Please give this a shot.  If you continue to experience problems,
feel
> free to write us back on or after January 3rd.
>
> Hope that helps.
>
> Thanks,
> John
>
> >
> > <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754 >
> >
> > John,
> >     Thanks for all the information and it is very helpful. I have
> two> more questions and request you to to provide information
> >
> > 1.  File entitled "test.grib" have the data on Gaussian grid for
the
> > entire world.
> >
> >     (i). ran copygb on a customized grid that corresponds to CONUS
> > region, i.e., 20N-55N,130w-45w
> >
> >     $ grid='255 0 201 201 20000 230000 128 55000 315000 100 100
64'
> >     $ copygb -g"$grid" -x test.grib test_conus.grib
> >
> >          I believe that "test_conus.grib" will have lat and long
> > correspond to CONUS and data interpolated from it's native
> (Gaussian)> grid to the above mentioned customized grid.
> >
> >     ii.  ran copygb command as below mentioned with "-B" option.
> >
> >     $ copygb -x -B test_conus.grib test.grib
> test_conus_gaussian.grib>
> >          As you mentioned, the above command masks the data
without
> > changing grid boundary definition. Therefore,
> "test_conus_gaussian.grib"> will have data only corresponds to
> CONUS region on it's native grid. I
> > ran wgrib -V command on both files, i.e., "test.grib" and
> > "test_conus_gaussian.grib". The summary looked almost same except
> some> part of the text. I am not sure what does it reflects though.
> In this
> > regard, to make sure every thing is working fine I like to
> compare data
> > corresponds to the CONUS region from the two files.  is it
> possible to
> > do this? Greatly appreciate your suggestions.
> >
> > 2. I also have .grib.index files. I need to find out contents of
the
> > file, however, I guess that these files may have information such
as
> > lat/long, sequence of grids, etc. related to data.  I like to
> confirm> with you that what ever is there in .grib.indeix that is
> still> applicable for the files created from 1(ii) as grid
> information is not
> > changed. Please confirm.
> >
> >
> > Thanks much,
> > Satish
> >
> >
> > On 12/17/2010 6:17 PM, RAL HelpDesk {for John Halley Gotway}
wrote:
> >> Satish,
> >>
> >> My responses are inline...
> >>
> >> On 12/14/2010 03:00 PM, RAL HelpDesk {for Satish Regonda} wrote:
> >>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
> >>>
> >>> Dear John Halley Gotway,
> >>>     This helps a lot. Figures made me to understand easily. I
> have few
> >>> questions and request you provide some light on the same. Also,
> request>>> you to correct me if I am wrong on the following.
> >>>
> >>> 1. wgrib -d 360 -grib -o land_mask.grb
> nam_218_20101210_0000_012.grb>>>      Record 360 corresponds to
> land mass and the above commands pulls
> >>> out
> >>> all the information corresponding to land mass (of North
> America). This
> >>> information will be having lat/long information as well and is
> supplied>>> to copygb. Please confirm. If it so, how can I pull out
> information>>> that
> >>> corresponds to CONUS? I believe supplying lat-long information
> of CONUS
> >>> in a grib file via copygb provides solution to my problem.
> >>>
> >> Yes, this is correct.  "-d 360" tells copygb to only extract
record
> >> number 360 which does contain the record for "LAND" which is a
> 0/1 mask
> >> for where there's land versus water.  The lat/lon
> >> information is contained in the Grid Description Section (GDS)
> section>> of each GRIB record.  To my knowledge, there isn't a way
> of providing
> >> lat/lon's to use to subset the domain.
> >>
> >>> 2. 'copygb' command reads lat/long information from a file that
is
> >>> followed by -B and then reads data corresponds to this region
from
> >>> input
> >>> file, and then writes into output file. If this is so, the
> following>>> command should do the job for me. Please confirm.
> >>>    copygv -x -B conus_lat_long_file inputfile.grib
outputfile.grib
> >>>
> >>>     As you mentioned it is not necessary that files entitled
> >>> "conus_lat_long_file" and  "inputfile.grib" not necessarily on
> the same
> >>> grid scale.
> >>>
> >> Yes, that's true "conus_lat_long_file" and "inputfile.grib" do
> not need
> >> to be on the same grid.  However, I believe your
> "conus_lat_long_file">> has to be a GRIB file.
> >>
> >>
> >>
> >>> 3. You did use option  -A '>0', does it retain values only that
> are>>> greater than "0"?
> >> Yes, in that example listed below, "-A '>0'" tells copygb to
> only use
> >> the grid points where the file land_mask.grb has a value greater
> than 0.
> >>    copygb -x -B land_mask.grb -A '>0'
nam_218_20101210_0000_012.grb
> >> nam_over_land.grb
> >>
> >>> 4. I ran the following command, and I believe that it masks
> landmass>>> region. The file size decreased from 51M to 6.1 M. I
> ran "wgrib -V" for
> >>> the first record of two files and from outset it looks like the
> same>>> Gaussian grid maintained in two files. one variable
> "bitmap: 68724
> >>> undef" is added but am not sure what is it.
> >>>
> >>>   copygb -x -B land_mask.grb test.grib test_land_maks.grib
> >>>
> >>>
> >>> $ wgrib -V test.grib -d 0
> >>> rec 1:0:date 1999010100 PRATE kpds5=59 kpds6=1 kpds7=0
> levels=(0,0)>>> grid=126 sfc 6hr fcst:
> >>>    PRATE=Precipitation rate [kg/m^2/s]
> >>>    timerange 10 P1 0 P2 6 TimeU 1  nx 384 ny 190 GDS grid 4
> num_in_ave>>> 0
> >>> missing 0
> >>>    center 7 subcenter 0 process 82 Table 2 scan: WE:NS
winds(N/S)
> >>>    gaussian: lat  89.277000 to -89.277000
> >>>              long 0.000000 to -0.938000 by 0.938000, (384 x
> 190) scan 0
> >>> mode 128 bdsgrid 1
> >>>    min/max data 0 0.002421  num bits 12  BDS_Ref 0  DecScale 6
> BinScale>>> 0
> >>>
> >>> $  wgrib -V test_land_maks.grib  -d 0
> >>> rec 1:4:date 1999010100 PRATE kpds5=59 kpds6=1 kpds7=0
> levels=(0,0)>>> grid=126 sfc 6hr fcst: bitmap: 68724 undef
> >>>    PRATE=Precipitation rate [kg/m^2/s]
> >>>    timerange 10 P1 0 P2 6 TimeU 1  nx 384 ny 190 GDS grid 4
> num_in_ave>>> 0
> >>> missing 0
> >>>    center 7 subcenter 0 process 82 Table 2 scan: WE:NS
winds(N/S)
> >>>    gaussian: lat  89.277000 to -89.277000
> >>>              long 0.000000 to -0.938000 by 0.938000, (384 x
> 190) scan 0
> >>> mode 128 bdsgrid 1
> >>>    min/max data 0 0.00057  num bits 10  BDS_Ref 0  DecScale 6
> BinScale>>> 0
> >>>
> >> When you do the masking using the "-B" option, the grid
> definitions will
> >> remain unchanged.  Remember, this isn't regridding the data,
> it's just
> >> masking it out.  However, when you look at the file
> >> sizes before and after, the one after the masking should be
> smaller.>>
> >>> 6. regridding using the "-g" option: Having grid that covers
CONUS
> >>> region @ Gaussian scale makes my problem simple. I did look
> into the
> >>> table but did not find the grid. If you know any information on
> this>>> kindly let me know.
> >> This is what I'm trying to tell you.  There is no predefined
> grid you
> >> should use.  Instead, you should define your own grid
> specification that
> >> matches closely with the CONUS subset you'd like to use.
> >>   Please look at the following website for an example of
> defining your
> >> own custom grid:
> >>
>
http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/run2.php>>
> >> Just look at the example on that page, and try to define your
> own grid
> >> that makes sense for your data.
> >>
> >> Hope that helps.
> >>
> >> John Halley Gotway
> >>
> >>>     Greatly appreciate your answers/suggestions.
> >>> Thanks much,
> >>> Satish
> >>>
> >>> ----- Original Message -----
> >>> From: RAL HelpDesk {for John Halley Gotway}<met_help at ucar.edu>
> >>> Date: Tuesday, December 14, 2010 1:49 pm
> >>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a
smaller
> >>> region
> >>> (ggrib,copygb)
> >>>
> >>>> Satish,
> >>>>
> >>>> Actually, the masking does in fact reduce the file size.  Here
> are>>>> the sizes for the files who's picture I sent:
> >>>>
> >>>> -rw-r--r-- 1 johnhg rap4  32M 2010-12-10 00:04
> >>>> gfs_3_20101210_0000_012.grb-rwxr-xr-x 1 johnhg rap4 4.4M 2010-
> 12-14
> >>>> 10:03 gfs_masked_by_nam.grb*
> >>>> -rw-r--r-- 1 johnhg rap4 118M 2010-12-10 00:15
> >>>> nam_218_20101210_0000_012.grb-rwxr-xr-x 1 johnhg rap4  51M
> 2010-12-
> >>>> 14 09:58 nam_over_land.grb*
> >>>>
> >>>> The GFS reduced in size from 32M down to 4.4M when masking over
> >>>> CONUS.  And the NAM reduced in size from 118M down to 51M when
> >>>> masking over land.
> >>>>
> >>>> copygb does in fact throw away that data is isn't using.  It
> stores>>>> a 0/1 bitmap field to define where it does/does not have
> data.  It
> >>>> only stores the data values where the bitmap is set to 1.
> >>>>
> >>>> So masking the data may in fact be a reasonable way of
> reducing the
> >>>> file size.  Of course, regridding it using the "-g" option of
> >>>> copygb would work too.
> >>>>
> >>>> John
> >>>>
> >>>>
> >>>> On 12/14/2010 11:15 AM, RAL HelpDesk {for Satish Regonda}
wrote:
> >>>>> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
> >>>>>
> >>>>> Dear John Halley Gotway,
> >>>>>     Thanks very much for the detailed useful information.
> >>>>>     You got it what I want to do, i.e., extract information
> for a
> >>>> smaller>  regions with out any interpolation. I am in the
> process of
> >>>> downloading>  CFSV2 hindcasts and as you know these require a
> lot of
> >>>> storage space and
> >>>>> am hoping extracting data on to CONUS region greatly decrease
> >>>> storage>  requirements.'mask' option does not offer much help
> as it
> >>>> keeps the
> >>>>> entire data in the file.
> >>>>>     I have already gone through the tutorial that you
mentioned
> >>>> and felt
> >>>>> "Interpolate to a pre-defined NCEP grid" will be useful. My
> >>>> gribdata is
> >>>>> on Gaussian grid, as per the table the value is 126. So, a
> pre-
> >>>> defined>  grid that corresponds to CONUS region with Gaussian
> T126>>>> grid will solve
> >>>>> my problem but did not find the same in the list of the pre-
> >>>> defined NCEP
> >>>>> grids
(http://www.nco.ncep.noaa.gov/pmb/docs/on388/tableb.html).
> >>>>>     ggrib is one of the ncep products
> >>>>> (http://www.cpc.ncep.noaa.gov/products/wesley/ggrib.html), if
> >>>> this works
> >>>>> my problem solved but is not working for me.
> >>>>>
> >>>>>       Kindly let me know your suggestions.
> >>>>> Thanks much
> >>>>> Satish
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> ----- Original Message -----
> >>>>> From: RAL HelpDesk {for John Halley Gotway}<met_help at ucar.edu>
> >>>>> Date: Tuesday, December 14, 2010 12:06 pm
> >>>>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a
> smaller>>>> region>  (ggrib,copygb)
> >>>>>> Satish,
> >>>>>>
> >>>>>> First, I'm not familiar with ggrib - we only really use
copygb
> >>>> here.>>
> >>>>>> So I understand that you'd like to create a subset of a GRIB
> >>>> record
> >>>>>> without actually interpolating it.  The short answer is that
I
> >>>> do
> >>>>>> not know how to do that directly.
> >>>>>>
> >>>>>> I believe that if you'd like to only look at a subset of the
> >>>> data
> >>>>>> that would by definition change how the grid is defined.  For
> >>>>>> example, if you want to reduce the number of grid point
you're
> >>>> look
> >>>>>> at -
> >>>>>> say from 360x180 down to 100x100 - that would change the grid
> >>>>>> definition.  And you'd need to regrid using the "-g" option
in
> >>>>>> copygb to do that regridding.  However, if you just want to
> >>>> "mask"
> >>>>>> out a
> >>>>>> subset of the data in your input file you do have some
options.
> >>>>>>
> >>>>>> So here are some things you may want to consider trying:
> >>>>>>
> >>>>>> (1) First, you could create a user-defined grid to regrid
your
> >>>> data
> >>>>>> using the "-g" option.  We've included some examples in the
MET
> >>>>>> online tutorial describing how to do this:
> >>>>>>
> >>>>>>
> >>>
>
http://www.dtcenter.org/met/users/support/online_tutorial/METv3.0/copygb/index.phpJust>>>>
click on the forward arrow to advance through the pages.  If you
choose
> >>>>> a grid who's grid points are very similar to the input grid,
the
> >>>> effect>  of interpolating will be very minimal.  For a
> >>>>>> lat/lon grid, you should be able to define an exact subset.
> For>>>>>> other projections, that'd be more difficult.
> >>>>>>
> >>>>>> (2) If you're using this GRIB data as input to the MET tools,
> >>>> you
> >>>>>> could just leave the data on it's native domain.  And then in
> >>>> MET,
> >>>>>> you can using the "mask_grid" and "mask_poly" options in the
> >>>>>> configuration files to define the subsets of the grid over
> which>>>>>> you'd like to perform the verification.
> >>>>>>
> >>>>>> (3) You can use copygb to "mask out" subsets of your domain
in
> >>>>>> which your interested.  Please note, this will NOT regrid the
> >>>> data,
> >>>>>> just mask it out on it's native grid.  Here are some
examples:
> >>>>>>    # Retrieve a sample NAM file
> >>>>>>    wget http://nomads.ncdc.noaa.gov/data/meso-eta-
> >>>>>> hi/201012/20101210/nam_218_20101210_0000_012.grb
> >>>>>>    # Use wgrib to pull out the record for the land mask
> >>>>>>    wgrib -d 360 -grib -o land_mask.grb
> nam_218_20101210_0000_012.grb>>>>>>
> >>>>>>    # Use copygb to mask out the NAM data only over land
> >>>>>>    # The -B option defines the masking region and the -A
option
> >>>>>> defines a threshold to be applied to that field
> >>>>>>    copygb -x -B land_mask.grb -A '>0'
> >>>> nam_218_20101210_0000_012.grb
> >>>>>> nam_over_land.grb
> >>>>>>    Attached you can see picture of the NAM data before the
> >>>> masking
> >>>>>> and after the masking.  These were created using the IDV
tool.
> >>>>>>
> >>>>>> (4) Also, please note that the masking region does not need
to
> >>>> be
> >>>>>> on the same grid as the input region.  For example:
> >>>>>>    # Retrieve a GFS file
> >>>>>>    wget http://nomads.ncdc.noaa.gov/data/gfs-avn-
> >>>>>> hi/201012/20101210/gfs_3_20101210_0000_012.grb
> >>>>>>    # Mask out the GFS data only over the NAM domain
> >>>>>>    copygb -x -B nam_218_20101210_0000_012.grb
> >>>>>> gfs_3_20101210_0000_012.grb gfs_masked_by_nam.grb
> >>>>>>
> >>>>>>    Again, I've attached images of the GFS data before and
after
> >>>>>> this masking operation.  But note that this has not actually
> >>>>>> changed the definition of the grid - just where the data is
> valid.>>>>>>
> >>>>>> Hope that helps.
> >>>>>>
> >>>>>> Thanks,
> >>>>>> John Halley Gotway
> >>>>>>
> >>>>>> On 12/14/2010 09:23 AM, RAL HelpDesk {for Satish Regonda}
> wrote:>>>>>>> <URL:
> https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>>>>>>>>
> >>>>>>>
> >>>>>>> Dear John Halley Gotway,
> >>>>>>>     I did register. Kindly let me know if you need any
> additional>>>>>>> information.
> >>>>>>> thanks much,
> >>>>>>> Satish
> >>>>>>>
> >>>>>>> ----- Original Message -----
> >>>>>>> From: RAL HelpDesk {for John Halley
Gotway}<met_help at ucar.edu>
> >>>>>>> Date: Tuesday, December 14, 2010 11:18 am
> >>>>>>> Subject: Re: [rt.rap.ucar.edu #42754] copy GRIBdata for a
> >>>> smaller
> >>>>>> region>  (ggrib,copygb)
> >>>>>>>> Satish,
> >>>>>>>>
> >>>>>>>> We are not able to offer direct support to users who have
not
> >>>>>> yet
> >>>>>>>> registered on the MET website.  We do this to ensure that
we
> >>>>>> remain
> >>>>>>>> in compliance with the international export laws of the
> United>>>>>>>> States.
> >>>>>>>>
> >>>>>>>> To fill out the free registration, please go here:
> >>>>>>>>    http://www.dtcenter.org/met/users/downloads/index.php
> >>>>>>>>
> >>>>>>>> Enter your email address in the box and hit enter.  That'll
> >>>> take
> >>>>>>>> you to the registration page.
> >>>>>>>>
> >>>>>>>> Please write us back to let us know when you've registered.
> >>>>>>>>
> >>>>>>>> Thanks,
> >>>>>>>> John Halley Gotway
> >>>>>>>> met_help at ucar.edu
> >>>>>>>>
> >>>>>>>> On 12/14/2010 08:26 AM, RAL HelpDesk {for Satish Regonda}
> wrote:>>>>>>>>> Tue Dec 14 08:26:56 2010: Request 42754 was acted
> upon.>>>>>>>>> Transaction: Ticket created by
Satish.Regonda at noaa.gov
> >>>>>>>>>         Queue: met_help
> >>>>>>>>>       Subject: copy GRIBdata for a smaller region
> (ggrib,copygb)>>>>>>>>>         Owner: Nobody
> >>>>>>>>>    Requestors: Satish.Regonda at noaa.gov
> >>>>>>>>>        Status: new
> >>>>>>>>>   Ticket<URL:
> >>>>>>>> https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=42754>
> >>>>>>>>>
> >>>>>>>>> Hi,
> >>>>>>>>>      I like to extract data from a grib file for a smaller
> >>>>>> region
> >>>>>>>> (e.g.,
> >>>>>>>>> CONUS) on its native grid; I do not want to do  any
> >>>>>>>> interpolation. I
> >>>>>>>>> understood that copygb and ggrib will do the job but
unable
> >>>> to
> >>>>>>>> figure out.
> >>>>>>>>> 1. copygb options,  "-B" and "-g" (grid= -1 yields output
> >>>> grid
> >>>>>> as
> >>>>>>>> input
> >>>>>>>>> grid), might do the job but did not find any guidelines to
> >>>> pass
> >>>>>>>> lat and
> >>>>>>>>> long information of a region that I want to extract the
data
> >>>>>>>>> 2. ggrib should do the job but when I executed the
following
> >>>>>>>> messaged
> >>>>>>>>> displayed.
> >>>>>>>>>
> >>>>>>>>> $ ggrib test.grib conus_test.grib -130 25 -50 55
> >>>>>>>>> ERROR: Grid #   1 not in geographic coordinates (lon,lat),
> >>>> exiting>>>>>
> >>>>>>>>> Any help is greatly appreciated.
> >>>>>>>>> Thanks much,
> >>>>>>>>> Satish
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >
>
>
>
>

------------------------------------------------


More information about the Met_help mailing list