Re: Error on reading grib file after WPP

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 24 Oct 2008 10:44:28 -0600

Hello,

NCL's internal variable model is the same as the variable model
used by netCDF. One rule of netCDF files is that all variables
must have unique names.

GRIB is *not* a file format. It is a *record* format. When GRIB
records are grouped together is some arbitrary fashion, the result
is a 'GRIB file'. However, there are no file rules.

When NCL 'reads' a file containing GRIB records, it attempts
to create unique names following netCDF file rules.

The 1st file you sent was an initialization file.
The variable, A_PCP_GDS0_SFC_acc, did not have a '3h' appended to
the end because there was no accumulation period. Note: all the values
are 0.0.

The 2nd file is a forecast file. Hence the A_PCP_GDS0_SFC_acc variable
had the number of hours over which the accumulation pertained [here, 3
hours]
appended to the name, A_PCP_GDS0_SFC_acc3h. The next release of NCL
(5.0.1) will allow uses to tell NCL to *not* apply the time period suffix

http://www.ncl.ucar.edu/future_release.shtml#NewFunctionality5.0.1

You could apply the following to read the data:

afile = addfile(dir+ifim(i),"r")
;print(afile)

if (isfilevar(afile, "A_PCP_GDS0_SFC_acc")) then
    apcp = afile->A_PCP_GDS0_SFC_acc
else
    if (isfilevar(afile, "A_PCP_GDS0_SFC_acc3h")) then
         apcp = afile->A_PCP_GDS0_SFC_acc3h
    end if
end if
printVarSummary(apcp)

====

Note: When reading or using an entire variable (say) X,
          it is better to use just X. It is less efficient to use X(:,:).

Good luck
D
Jin-Young Kim wrote:
> Dear Dr. Shea
>
> I'm really appreciate you to concern this problem
> and give useful comment on the program .
>
> I also could follow your saying
>
> But i've faced the same problem by using different time data.
>
> How do you think the reason?
>
> I've upload 06 UTC data for the nested domain.
> So its name is wrfprs_d02.06 which is uploaded to ftp server
>
> Would you look at this?
>
>
> Best regards,
> Jin-Young Kim
>
>
>
>
> On Thu, Oct 23, 2008 at 9:52 AM, Dennis Shea <shea_at_ucar.edu
> <mailto:shea_at_ucar.edu>> wrote:
>
> I modified you script for a test. All works correctly.
>
> =========================================
> begin
>
> dir = "./"
>
> ifim= (/"wrfprs_d01.00"+".grb"/)
> ofim= (/"TEST"/)
>
> titl = sprinti("%0.2i", ispan(0,72,6)) ; <=====
> better than ""xx"
> ;titl= (/"00","06","12","18"\
> ; ,"24","30","36","42"\
> ; ,"48","54","60","66"\
> ; ,"72"/)
>
> ;************************************************
> ; Use WRF_contributed procedure to set map resources
> ;************************************************
>
> do i= 0, dimsizes(ifim)-1
>
> afile = addfile(dir+ifim(i),"r")
> ;print(afile)
>
> apcp = afile->A_PCP_GDS0_SFC_acc(:, :)
> printVarSummary(apcp)
> exit
>
> psfc = afile->PRMSL_GDS0_MSL(:, :)
> psfc = psfc*0.01
> psfc_at_units = "hPa" ; Pa
>
> u10m = afile->U_GRD_GDS0_HTGL(:, :)
> u10m_at_units = "m/s" ; m/s
>
> v10m = afile->V_GRD_GDS0_HTGL(:, :)
> v10m_at_units = "m/s" ; m/s
>
> end do
>
> end
>
>
> =======================================
>
> /project/cas/shea/GRIB> ncl prcp.ncl
>
> Copyright (C) 1995-2007 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 5.0.0
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> warning:NclGRIB: Unknown grib parameter number detected (154,
> center 7, table version 130 grib record 386), using default
> variable name (VAR_154)
> warning:NclGRIB: Unknown grib parameter number detected (171,
> center 7, table version 130 grib record 408), using default
> variable name (VAR_171)
> warning:NclGRIB: Unknown grib parameter number detected (168,
> center 7, table version 129 grib record 419), using default
> variable name (VAR_168)
> warning:NclGRIB: Unknown grib parameter number detected (169,
> center 7, table version 129 grib record 420), using default
> variable name (VAR_169)
>
>
> Variable: apcp
>
> Type: float
> Total Size: 391812 bytes
> 97953 values
> Number of Dimensions: 2
> Dimensions and sizes: [g0_lat_0 | 309] x [g0_lon_1 | 317]
> Coordinates:
> g0_lat_0: [-10.471..-65.911]
> g0_lon_1: [-98.886..-42.006]
> Number Of Attributes: 11
> center : US National Weather Service - NCEP (WMC)
> long_name : Total precipitation
> units : kg/m^2
> _FillValue : -999
> level_indicator : 1
> gds_grid_type : 0
> parameter_table_version : 2
> parameter_number : 61
> forecast_time : 0
> forecast_time_units : hours
> initial_time : 07/06/2005 (00:00)
>
Received on Fri Oct 24 2008 - 10:44:28 MDT

This archive was generated by hypermail 2.2.0 : Fri Oct 24 2008 - 14:07:49 MDT