Lambert Conformal GRIB to NetCDF

From: Hauss Reinbold <hauss.reinbold_at_nyahnyahspammersnyahnyah>
Date: Mon, 27 Oct 2008 21:51:40 -0700

Hi all,

I am attempting to convert a GRIB file with weather data that is on a
lambert conformal grid into a netcdf file using NCL. I initially
tried ncl_convert2nc and it runs without error, but when I use a
netcdf viewer like panoply to view the file, the grid does not display
correctly because the grid points are not matched to the correct lat/
lon points.

Now I'm using the efficient output example in the GRIB to netCDF
section and I'm coming across a problem. The latitude and longitude
coordinate grids are 2-dimensional, each containing the lat and lon
points respectively of each point on the grid, since the lambert
conformal grid is not monotonically increasing in lat and lon.

Because of this, when I have the following code (snipped for relevance):

lat = grib_in->g3_lat_0
lon = grib_in->g3_lon_1

lat!0 = "lon"
    lat!1 = "lat"

    lon!0 = "lon"
    lon!1 = "lat"

    printVarSummary(lat)

    nlev = dimsizes(lev)
    nlat = dimsizes(lat)
    nlon = dimsizes(lon)

    setfileoption(netcdf_out,"DefineMode", True)

    dimNames = (/"time","lat","lon","lev"/)
    dimSizes = (/-1,nlat,nlon,nlev/)
    dimUnlim = (/True,False,False,False/)
    filedimdef(netcdf_out,dimNames,dimSizes,dimUnlim)

I get an error at the dimSizes line (with print out of lat variable
included):

Variable: lat
Type: float
Total Size: 97696 bytes
             24424 values
Number of Dimensions: 2
Dimensions and sizes: [lon | 142] x [lat | 172]
Coordinates:
Number Of Attributes: 11
   corners : ( -40.16801, -40.21574, -32.46025, -32.4188 )
   long_name : latitude
   GridType : Lambert Conformal Secant or Tangent, Conical or bipolar
   units : degrees_north
   Latin2 : -30
   Latin1 : -60
   Dy : 6000
   Dx : 6000
   Lov : 145
   Lo1 : 138.367
   La1 : -40.168
fatal:_NclBuildArray: each element of a literal array must have the
same dimension sizes, at least one item doesn't
fatal:Execute: Error occurred at or near line 47 in file
convert2ncl-2.ncl

The examples I'm seeing look like they are for simple monotonically
increasing grids. Is it possible to do this for lambert conformal and
if so, what should I change? Thanks for any help.

***************************
Hauss Reinbold
Assitant Research Scientist/Programmer
Hauss.Reinbold_at_dri.edu
775-673-7386
*****************************

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Oct 27 2008 - 22:51:40 MDT

This archive was generated by hypermail 2.2.0 : Tue Oct 28 2008 - 09:54:43 MDT