Re: NCEP reanalysis data in grib format

From: David Ian Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Mon, 13 Mar 2006 14:21:17 -0700

Ncl-talk subscribers may be interested in the work-around fix for this
problem and our plans for a simpler permanent fix.
The problem occurs because NCL is using two different parameter
tables for these two files.

For prs.grib.mean.y1957.grb NCL is using the NCEP reanalysis parameter
table,
whereas for prs.grib.mean.y1958.grb it is using the standard NCEP
operational
table. Evidently the reanalysis table is the correct table to use in
this case.
 From what I have gathered, this problem has a long history that
predates NCL.
Basically, for a time NCEP did not clearly distinguish between
these 2 tables. You can see the confusion in the source code of wgrib,
where there is a rather
convoluted set of conditions used to determine which table should
apply. wgrib also
has a command line switch specifically devoted to forcing the use of
one or the other of
these tables in cases where its conditional code comes up with the
wrong answer.

NCL does not currently have such a command line argument, but it is
possible
to force the use of the reanalysis table by setting up a user-defined
parameter table.
To do this, copy the reanalysis parameter table at
http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/ncep_reanal.txt
into your home directory somewhere. The text of this file begins as
follows:

!
! NCL parameter table text file
! US National Weather Service - NCEP (WMC)
! Reanalysis
!
-1 : 7 : 1 : 0
1 : PRES : Pa : Pressure
2 : PRMSL : Pa : Pressure reduced to MSL
3 : PTEND : Pa/s : Pressure tendency
6 : GP : m^2/s^2 : Geopotential

Modify the line
-1 : 7 : 1 : 0
to
-1:7:-1:-1

Save the file and then set the
environment variable NCL_GRIB_PTABLE_PATH
to the path of the file as you have saved it.
For instance,
(csh)
setenv NCL_GRIB_PTABLE_PATH /home/userid/ncep_reanal.txt
(ksh, bash)
export NCL_GRIB_PTABLE_PATH=/home/userid/ncep_reanal.txt

This will cause the reanalysis table to be used for all GRIB files from
NCEP,
which has a center id of 7.

This solution allowed Dr. Lee to see the contents of both files the
same way.

It turns out that the only significant difference in the record headers
between these two files is that the 1957 file has the sub-center id set
to
1 while the 1958 file has the sub-center id set to 0.

When the center is 7 and the sub-center is set to 1, according to the
GRIB documents, it
means the file belongs to the "NCEP Re-Analysis Project", so it is
clearly a re-analysis file.
But when the sub-center is 0, given the other elements of this file,
both NCL and wgrib
fail to determine whether the file is a re-analysis file or not.
However, when they cannot
decide, wgrib defaults to using the re-analysis table while NCL
defaults to the operational
table. When this situation occurs, wgrib provides a warning message
saying essentially
that it is guessing.

Our plan for a simpler permanent fix is to implement a new file option
that allows the user to
specify which table to use when NCL is unable to determine whether the
reanalysis or the
operational table is correct. In the interest of not breaking existing
code, NCL's default
choice will remain unchanged.
  -dave

On Mar 9, 2006, at 6:38 PM, Sang-ki Lee wrote:

> I am working with NCEP reanalysis data in grib format. My NCL script
> reads wrong names.
>
> I have two files: prs.grib.mean.y1957, and prs.grib.mean.y1958.
> "getfilevarnames" gives me two different lists:
>
> prs.grib.mean.y1958 prs.grib.mean.y1957
> (0) initial_time0 initial_time0
> (1) lv_ISBL1 lv_ISBL1
> (2) lon_2 lon_2
> (3) lat_2 lat_2
> (4) lv_ISBL4 lv_ISBL4
> (5) lv_ISBL5 lv_ISBL5
> (6) initial_time0_encoded initial_time0_encoded
> (7) initial_time0_hours initial_time0_hours
> (8) NCIP_2_ISBL_113 CBTMW_2_ISBL_113
> (9) VSTM_2_ISBL_113 CBTZW_2_ISBL_113
> (10) USTM_2_ISBL_113 CBMZW_2_ISBL_113
> (11) CPOZP_2_ISBL_113 CBQW_2_ISBL_113
> (12) CPOFP_2_ISBL_113 CBTW_2_ISBL_113
> (13) POP_2_ISBL_113 CBVQ_2_ISBL_113
> (14) PROBN_2_ISBL_113 CBUQ_2_ISBL_113
> (15) PROB_2_ISBL_113 CBVW_2_ISBL_113
> (16) HLCY_2_ISBL_113 CBUW_2_ISBL_113
> (17) R_H_2_ISBL_113 RH_2_ISBL_113
> (18) SPF_H_2_ISBL_113 SPFH_2_ISBL_113
> (19) REL_D_2_ISBL_113 REL_D_2_ISBL_113
> (20) REL_V_2_ISBL_113 REL_V_2_ISBL_113
> (21) V_VEL_2_ISBL_113 V_VEL_2_ISBL_113
> (22) V_POT_2_ISBL_113 V_POT_2_ISBL_113
> (23) STRM_2_ISBL_113 STRM_2_ISBL_113
> (24) V_GRD_2_ISBL_113 V_GRD_2_ISBL_113
> (25) U_GRD_2_ISBL_113 U_GRD_2_ISBL_113
> (26) VTMP_2_ISBL_113 VTMP_2_ISBL_113
> (27) TMP_2_ISBL_113 TMP_2_ISBL_113
> (28) HGT_2_ISBL_113 HGT_2_ISBL_113
>
> The list in the left (prs.grib.mean.y1958) is not correct, because
> when I plot "VSTM_2_ISBL_113", for instance, it gives me reasonable
> values for "CBMZW_2_ISBL_113". So, I know that the name is switched
> somehow. A colleague of mine tried to upload the two data on Matlab,
> and the two data have the same name convention.
>
> My NCL script file is very simple:
> ----------------------------------------------------------------------
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> begin
> ;***********************************************
> ; to use the environmental variable
> ;***********************************************
> grib_in = addfile("prs.grib.mean.y1957.grib", "r")
> names = getfilevarnames(grib_in)
> print(names)
> ----------------------------------------------------------------------
>
> I don't have a clue......
>
> Thank you.
>
> Sang-ki
> --
> ----------------------------------------------------------------------
> Dr. Sang-ki Lee
> RSMAS/CIMAS
> University of Miami
> 4600 Rickenbacker Causeway
> Miami, FL 33149 USA
> Tel) 305-361-4521
> Fax) 305-361-4412
> E-mail) sang-ki.lee_at_noaa.gov
> Homepage) http://www.aoml.noaa.gov/phod/people/sklee.html
> ----------------------------------------------------------------------
> Mailing-address:
> Dr. Sang-ki Lee
> AOML/PHOD
> 4301 Rickenbacker Causeway
> Miami, FL, 33149 USA
> ----------------------------------------------------------------------
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Mar 13 2006 - 14:21:17 MST

This archive was generated by hypermail 2.2.0 : Tue Mar 14 2006 - 08:36:27 MST