Re: array shape questions

From: Adam Phillips (asphilli AT XXXXXX)
Date: Tue Apr 27 2004 - 08:40:42 MDT

  • Next message: Mike Notaro: "histograms"

    >Hi,
    >
    >I have an array A(nt,nl,nlat,nlon) which I want to interpolate to an
    >array of lat,lon point pairs, to do this I flatten my output arrays into
    >1D and use linint2_points_Wrap which gives an output of
    >B(nt,nl,olat*olon). How do I reshape this to B(nt,nl,olat,olon)?
    >Also ncl is kindly outputing my 2D lat and lon arrays as variable
    >attributes (xcoord and ycoord) in the output netcdf file - how do I
    >prevent that?

    Jim,

    I would use ndtooned and onedtond to reshape your array:

    B2 = ndtooned(B) ;convert to 1D
    B3 = onedtond(B2,(/nt,nl,olat,olon/)) ;convert to 4D

    or

    B3 = onedtond(ndtooned(B),(/nt,nl,olat,olon/))

    As far as not wanting xcoord/ycoord to be included as attributes in the .nc
    file, you should be able to just delete the attributes:

    delete(B3@xcoord)
    delete(B3@ycoord)
    a = addfile("test.nc","c")
    a->B3 = B3

    Hope that helps.
    Adam

    >
    >
    >--
    >Jim Edwards jedwards AT ucar.edu
    >IBM Applications Analyst
    >NCAR SCD
    >BOULDER CO 303-497-1842
    >
    >
    >_______________________________________________
    >ncl-talk mailing list
    >ncl-talk AT ucar.edu
    >http://mailman.ucar.edu/mailman/listinfo/ncl-talk

    -------------------------------------------------------------
    Adam Phillips email: asphilli AT ucar.edu
    Climate and Global Dynamics Division tel: (303) 497-1726
    National Center for Atmospheric Research fax: (303) 497-1333
    P.O. Box 3000
    Boulder, CO 80307-3000 http://www.cgd.ucar.edu/~asphilli

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



    This archive was generated by hypermail 2b29 : Tue Apr 27 2004 - 12:22:51 MDT