Re: Attaching lat lon coords to variable grid

From: Dennis Shea (shea AT cgd.ucar.edu)
Date: Fri Oct 14 2005 - 13:25:10 MDT

  • Next message: Zhuanshi He: "Re: Your posting to ncl-talk"

    >
    >I have an irregular grid of 100x110 (100 lat, 110 lon).
    >The data, while in netCDF format, do not have lat/lon
    >values attached. They are provided in a separate
    >ASCII file. Each grid point has a unique lat/lon, that
    >is, it does not form a regular lat/lon box - there are
    >11000 lat values and 11000 lon values. Reading
    >everything in is fine, but how do I attach the lat lon
    >values to the data such that I can use various map
    >projections etc.
    >
    >How can I do this? Thanks for any help,

    You must provide more info. Without knowing the
    structure of the ascii file or the grid.

    Generic appraoch

    Say: x(lat,lon)

           nlat = 100
           mlon = 110
           npts = nlat*mlon
                                ; assuming 2 col lat lon
           ltln = asciiread("foo.LatLon", (/npts,2/), "float")
           
           lat2d = onedtond(ltln(:,0), (/nlat,mlon/))
           lat2d@units = "degrees_north"
           
           lon2d = onedtond(ltln(:,1), (/nlat,mlon/))
           lon2d@units = "degrees_east"
           
           x@lat2d = lat2d
           x@lon2d = lon2d
           
           
    u r ready to plot.

    Note, i f this is going to be used multiple times
    it would be a bit faster to make a netCDF files
    of the cpprdinates.

    good luck

    D
          

    _______________________________________________
    ncl-talk mailing list
    ncl-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Fri Oct 14 2005 - 17:15:50 MDT