Re: problem with assigning coordinates (fwd)A

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu, 16 Nov 2006 16:37:18 -0700 (MST)

Hi Gaby,

[1] Is this NARR [North American Regional Reanalysis] data?
    If so, the Climate Diagnostics center [CDC] has the
    data available in netCDF.

    see: http://www.cdc.noaa.gov/NARR/

[2] The NCL Applications page has examples of reading/plotting
    both GRIB and netCDF.

    see: http://www.ncl.ucar.edu/Applications/narr.shtml

[3] We don't use GrADS. ;-}

    However, I think that, by default,
    GrADS requires coordinate variables to be COARDS conforming.
    COARDS is a netCDF convention.

    see: http://ftp.unidata.ucar.edu/software/netcdf/conventions.html

    COARDS requires that "coordinate variables" be one dimensional,
    monotonically {in/de}creasing arrays. Further, the coordinate
    variable "time" should have units like "seconds since ...",
    "hours since ..."

   [NCL will produce this type of time variable if you set the following:
    setfileoption("grb","InitialTimeCoordinateType","Numeric") ]

    Adam Phillips created a WWW URL that talks about ".ddf" files
    which GrADS uses as a mechanism to read non-COARDS conforming
    netCDF.

    see: http://www.cgd.ucar.edu/cas/asphilli/ddfhelp.html

    This only talks about the time variable. Not sure what to do
    about 2D NARR coordinates with GrADS. They may have to be added
    manually to the ctl file.

[4] It looks like u r computing daily totals [8*3=24].
    N'est ce pas?

    Assuming u r using the current version of NCL [ a034 ],
    could u pls do an "ncl_filedump" of one of the files
    and send me the output.

    %> ncl_filedump narr.....grb > narr.dump

    or, you can send an example file [maybe 8 files if they are small]

    ftp ftp.cgd.ucar.edu
    anonymous
    email
    cd incoming
    put .... a NARR grib file
    exit

    Then tell me the name of the file.

[5] What do u mean by the following?

> ncdf_at_lat = lat
> ncdf_at_lon = lon
> ncdf_at_source = f1

Regards
Dennis Shea

On Thu, 16 Nov 2006, gaby colorado wrote:

> Hello, my name is Gaby, I made a program where i opened some GRB files and I
> calculated the sum of every 8 files, and i saved it in a new netcdf file but
> this file i canīt open with grads because it says that the x coordinate is
> not defined. I think that the problem is in assigning the coordinates
> (latitude y longitude) in the sum for the new file. The grb file has
> dimension gridx_221 and gridy_221 and has 2d lat/lon vars lat
> (gridx_221,gridy_221) and lon(gridx_221,gridy_221).
>
> Also i would like for you to provide me whith some tips to improve my
> program. Thanks a lot.
>
> The program is:
>
> 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"
>
> ;******************
> begin
> ;******************
>
> diri = "/home/gaby/datos/1995/grb/"
> diri2 = "/home/gaby/datos/1995/"
> fil = systemfunc ("ls " +diri+"narra3ss19950101*")
>
> f1 = addfiles (fil,"r")
> ListSetType (f1, "join")
>
> ;******************
> ;create a netcdf
> ;******************
> system ("rm "+diri2+"sumas.nc")
> ncdf = addfile(diri2+"sumas.nc","c")
> ;******************
>
> pcp = f1[:]->A_PCP_221_SFC_acc3h
> lat = f1[0]->gridlat_221
> lon = f1[0]->gridlon_221
> lon!0 = "lon"
> lon!1 = "lat"
> lat!0 = "lon"
> lat!1 = "lat"
>
> dimll = dimsizes(lat)
> nlon = dimll(0)
> nlat = dimll(1)
> time = fspan (0,7,8)
>
> pcp!0 = "time"
> pcp!1 = "lon"
> pcp!2 = "lat"
>
> temp = (pcp(lat|:,lon|:,time|:))
>
> ntime = 7
> ppt = temp(0::ntime/8-1,:,:)
>
> ntime2 = 1
> time2 = 1 + ispan (0,ntime2-1,1)
>
> suma = new ((/nlat,nlon,ntime2/), typeof(temp),temp@_FillValue)
>
> cntr = 0
> do gg = 0,ntime-2,8 ; increment do loop by 8
> suma(:,:,cntr) = (/dim_sum(temp(:,:,gg:gg+7)) /)
> cntr = cntr+1
> end do
>
>
> suma!0 = "lat"
> suma!1 = "lon"
> suma!2 = "time"
>
> suma2 = (suma(time|:,lat|:,lon|:))
>
> ;******************
> ;out file
> ;******************
>
> lon2 = lon(lat|:,lon|:)
> lat2 = lat(lat|:,lon|:)
>
> dimNames = (/ "time","lat","lon"/)
> dimSizes = (/ -1,nlat,nlon/)
> dimUnlim = (/ True,False,False/)
> filedimdef(ncdf,dimNames,dimSizes,dimUnlim)
>
> filevardef(ncdf, "time" ,typeof(time2),(/"time"/))
> filevardef(ncdf, "prec" ,typeof(suma2),(/"time","lat","lon"/))
>
> ncdf_at_lat = lat
> ncdf_at_lon = lon
> ncdf_at_source = f1
>
> sumas2_at_lat2d =lat2
> sumas2_at_lot2d = lon2
>
> ncdf->time = (/time2/)
> ncdf->lat = lat2
> ncdf->lon = lon2
> ncdf->prec = (/suma2/)
> ncdf_at_long_name = "Precipitacion diaria"
> ncdf_at_units = "mm/dia"
>
> end
>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Nov 16 2006 - 16:37:18 MST

This archive was generated by hypermail 2.2.0 : Sat Nov 18 2006 - 15:30:26 MST