[Met_help] Mode tool
John Halley Gotway
johnhg at rap.ucar.edu
Thu Oct 2 13:24:43 MDT 2008
Seagayle,
I don't know how much you know about the GRIB format, but there are some options for how to encode the data.
And those numbers, 8, 0, and 64 indicate give values for setting those options.
The "copygb.doc" file indicates that the grid info is specified in the "W3FI63" format... and here's a page that describes that format:
http://www.nco.ncep.noaa.gov/pmb/docs/libs/w3lib/w3fi63.html
Here's a selection from the page:
LAMBERT CONFORMAL GRIDS
(2) - NX NR POINTS ALONG X-AXIS
(3) - NY NR POINTS ALONG Y-AXIS
(4) - LA1 LAT OF ORIGIN (LOWER LEFT)
(5) - LO1 LON OF ORIGIN (LOWER LEFT)
(6) - RESOLUTION (RIGHT ADJ COPY OF OCTET 17)
(7) - LOV - ORIENTATION OF GRID
(8) - DX - X-DIR INCREMENT
(9) - DY - Y-DIR INCREMENT
(10) - PROJECTION CENTER FLAG
(11) - SCANNING MODE FLAG (RIGHT ADJ COPY OF OCTET 28)
(12) - LATIN 1 - FIRST LAT FROM POLE OF SECANT CONE INTER
(13) - LATIN 2 - SECOND LAT FROM POLE OF SECANT CONE INTER
The value of 8 is for the "RESOLUTION" flag.
The value of 0 is for the "PROJECTION CENTER FLAG".
The value of 64 is for the "SCANNING MODE FLAG".
Now if you really want the gory details, look for the "LAMBERT CONFORMAL" section on this page:
http://www.nco.ncep.noaa.gov/pmb/docs/on388/tabled.html
Each of the above values is broken down into the 8 bits that comprise the value - from most significant bit to least significant bit.
So a value n (between 0 and 128) is represented in binary as: 2^7 + 2^6 + 2^5 + 2^4 + 2^3 + 2^2 + 2^1 + 2^0. The 8 bits are set to 0 and 1 to determine if the bit is "ON" or "OFF".
A value of 8 (= 2^3) is the same as the bit sequence: 0 0 0 0 1 0 0 0, so the 5th bit is turned on and the rest are turned off.
A value of 0 has all 8 bits turned off.
A value of 64 (= 2^7) is the same as the bit sequence: 0 1 0 0 0 0 0 0 , so the 2nd bit is turned on and the rest are turned off.
Referring to the tables from the link above...
RESOLUTION FLAGS = 8 means:
"Direction increments not given"
"Earth assumed spherical with radius = 6367.47 km"
"u and v components of vector quantities resolved relative to the defined grid in the direction of increasing x and y (or i and j) coordinates respectively"
PROJECTION FLAG = 0 means:
"the North pole is on the projection plane"
"only one projection center used"
SCANNING MODE FLAG = 64 means:
"Points scan in +i direction"
"Points scan in +j direction"
"Adjacent points in i direction are consecutive"
Who knew 3 numbers could mean so much!
John
walford02 at hotmail.com wrote:
> John,
>
> You are great!!! thank you so much.
>
> Two rather random questions just because:
> the 3 indicates it is for Lambert Conf
> what does the 8 before the CENLON and the 0 64 before TRUELAT1 represent?
>
>
> --------------------------------------------------
> From: "John Halley Gotway" <johnhg at rap.ucar.edu>
> Sent: Thursday, October 02, 2008 12:47 PM
> To: <walford02 at hotmail.com>
> Cc: "met_help" <met_help at ucar.edu>
> Subject: Re: [Met_help] Mode tool
>
>> Seagayle,
>>
>> Since you're running ARW, you're right - copygb does not need to be
>> run. I've attached the output of copygb for the sample observation
>> file you sent, ST2ml2006072718.Grb. And below is the command I
>> used to regrid your observation file to match the forecast domain:
>>
>> copygb -xg"255 3 77 69 37777 -78655 8 -76880 4000 4000 0 64 60000
>> 30000" ST2ml2006072718.Grb ST2ml2006072718_REGRID.Grb
>>
>> Let me warn you that the files you sent contain an 18 hour
>> accumulation for the forecast and a 1 hour accumulation for the
>> observation. You'll need to use the PCP-Combine tool in MET to construct
>> forecast and observation accumulation intervals that match.
>>
>> Listed below are the steps I followed to figure out the copygb command:
>>
>> (1) Figure out the projection information of your forecast file using
>> the "wgrib" tool:
>> wgrib -V WRFPRS_d01.18
>>
>> In the output of wgrib, I found this projection information:
>> Lambert Conf: Lat1 37.777000 Lon1 -78.655000 Lov -76.880000
>> Latin1 60.000000 Latin2 30.000000 LatSP 0.000000 LonSP 0.000000
>> North Pole (77 x 69) Dx 4.000000 Dy 4.000000 scan 64 mode 8
>>
>> So it's on a Lambert Conformal grid with the parameters listed.
>>
>> (2) Figure out how to specify a Lambert Conformal grid for copygb by
>> referring to the WPP presentation from the WRF-Tutorial.
>> See slide 25 in the presentation:
>> http://www.mmm.ucar.edu/wrf/users/tutorial/200807/2008jul_wpp_joint_tutorial_FINAL.pdf
>>
>>
>> In there, the grid definition for Lambert Conformal grids is specified
>> as follows:
>> copygb -xg"255 3 NX NY STARTLAT STARTLON 8 CENLON DX DY 0 64 TRUELAT1
>> TRUELAT2" ST2ml2006072718.Grb ST2ml2006072718_REGRID.Grb
>> where lat and lon values are listed in millidegrees (multiply by
>> 1000), and dx and dy are in meters.
>>
>> (3) Substitute the numbers from the wgrib output into the copygb
>> command where:
>> STARTLAT = Lat1 * 1000
>> STARTLON = Lon1 * 1000
>> CENLON = Lov * 1000
>> DX = Dx * 1000
>> DY = Dy * 1000
>> TRUELAT1 = Latin1 * 1000
>> TRUELAT2 = Latin2 * 1000
>>
>> (4) Run the copygb command:
>> copygb -xg"255 3 77 69 37777 -78655 8 -76880 4000 4000 0 64 60000
>> 30000" ST2ml2006072718.Grb ST2ml2006072718_REGRID.Grb
>>
>> (5) Verify that it worked by running wgrib on the output file:
>> wgrib -V ST2ml2006072718_REGRID.Grb
>>
>> And in the wgrib output I see the following projection information,
>> which matches what's in the forecast file:
>> Lambert Conf: Lat1 37.777000 Lon1 -78.655000 Lov -76.880000
>> Latin1 60.000000 Latin2 30.000000 LatSP 0.000000 LonSP 0.000000
>> North Pole (77 x 69) Dx 4.000000 Dy 4.000000 scan 64 mode 8
>>
>> Hope that helps!
>> John
>>
>> walford02 at hotmail.com wrote:
>>> John,
>>>
>>> I did look at that copygb.doc file earlier but I still had a couple of
>>> questions.
>>>
>>> I am running WRF ARW not NMM and from my understanding ARW did not need
>>> to run copygb.exe in the WPP. But I don't want to change the forecast to
>>> the observations grid .. I want to do it the other way around.
>>>
>>> Anyway, I have put the observation file (ST*.Grb) and the forecast file
>>> (WRFPRS_d01.18) in the directory incoming/irap/johnhg.
>>>
>>>
>>> --------------------------------------------------
>>> From: "John Halley Gotway" <johnhg at rap.ucar.edu>
>>> Sent: Thursday, October 02, 2008 11:21 AM
>>> To: <walford02 at hotmail.com>
>>> Cc: "met_help" <met_help at ucar.edu>
>>> Subject: Re: [Met_help] Mode tool
>>>
>>>> Seagayle,
>>>>
>>>> You're definitely not the first person to be frustrated by lack of
>>>> good documentation for the copygb tool! I've attached a file named
>>>> "copygb.doc" which does give some info about running copygb, but
>>>> not much. A copy of this file should be included in the source code
>>>> directory of WPP.
>>>>
>>>> What we'll need to do is figure out the parameters that define your
>>>> forecast 77 x 69 grid. If your forecast data was postprocessed using
>>>> WPP, then copygb was probably run on it at some point in the
>>>> processing - perhaps by some script file. If that's the case, and you
>>>> can find the copygb command that was used with your forecast data,
>>>> that would indicate the arguments you'd need for copygb.
>>>>
>>>> But it may be easier for you to just send me a sample GRIB forecast
>>>> file. I'll extract the grid definition information from it and let you
>>>> know how to run copygb on your obs data to regrid it.
>>>>
>>>> So please send me 1 sample forecast and 1 sample observation file (so
>>>> I can check to make sure the copygb arguments I put together are
>>>> correct). If the files are too big for email, you could post
>>>> them to our anonymous ftp site with the following commands:
>>>>
>>>> cd "directory containing forecast and observation files"
>>>> ftp ftp.rap.ucar.edu
>>>> username: anonymous
>>>> password: "fill in your email address here"
>>>> cd incoming/irap/johnhg
>>>> put "name of the forecast file"
>>>> put "name of the observation file"
>>>> bye
>>>>
>>>> Thanks,
>>>> John
>>>>
>>>> walford02 at hotmail.com wrote:
>>>>> John,
>>>>>
>>>>> I do have copygb because I have WRF Post-Processor, but I am not
>>>>> familiar
>>>>> with it. I want my observations to be placed on the model forecast
>>>>> domain
>>>>> and to be honest it is not clear how I do this.
>>>>>
>>>>> My forecast grid dimensions are 77, 69 and my observation ( NCEP/EMC
>>>>> U.S.
>>>>> Gridded Multi-Sensor Precipitation (4 km) [NCAR/EOL]) grid dimensions
>>>>> are
>>>>> 1121, 881. How do I use copygb to change the observation grid
>>>>> dimensions to
>>>>> 77,69 ?
>>>>>
>>>>> The Documentation is not clear to me on how to do this. Can you
>>>>> point me
>>>>> to some clear directions on how to do this?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --------------------------------------------------
>>>>> From: "John Halley Gotway" <johnhg at rap.ucar.edu>
>>>>> Sent: Wednesday, October 01, 2008 1:57 PM
>>>>> To: <walford02 at hotmail.com>
>>>>> Cc: <met_help at mailman.ucar.edu>
>>>>> Subject: Re: [Met_help] Mode tool
>>>>>
>>>>>> Seagayle,
>>>>>>
>>>>>> We recommend using the copygb utility for regridding GRIB files. We
>>>>>> haven't included any interpolation options within MET itself, but
>>>>>> instead,
>>>>>> we require that the input fcst/obs fields reside on the
>>>>>> same domain.
>>>>>>
>>>>>> The copygb utility is distributed as part of the WRF
>>>>>> Post-Processor. So
>>>>>> if you have WPP installed, you'll already have copygb. If not,
>>>>>> you can
>>>>>> also access it from the NWS Climate Prediction Center Page:
>>>>>> http://www.cpc.noaa.gov/products/wesley/copygb.html
>>>>>>
>>>>>> If you have any trouble getting copygb to do what you'd like it to
>>>>>> do,
>>>>>> I'd
>>>>>> be happy to help.
>>>>>>
>>>>>> John
>>>>>>
>>>>>> walford02 at hotmail.com wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> I get an error when I run the MODE tool that says:
>>>>>>>
>>>>>>> ERROR: main() -> forecast and observation grid dimensions do not
>>>>>>> match
>>>>>>> (77, 69) != (1121, 881)
>>>>>>>
>>>>>>> Is there a way to downscale my observation grid dimensions to match
>>>>>>> the
>>>>>>> model forecast?
>>>>>>>
>>>>>>> Segayle
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Met_help mailing list
>>>>>>> Met_help at mailman.ucar.edu
>>>>>>> http://mailman.ucar.edu/mailman/listinfo/met_help
>>>>>>
>>>>
>>
More information about the Met_help
mailing list