Re: mm52ncdf

From: Dennis Shea (shea AT cgd.ucar.edu)
Date: Mon Nov 01 2004 - 09:49:59 MST

  • Next message: Benjamin Lamptey: "Re: mm52ncdf"

    Ben

    >I am trying to convert the variable x(nyear, nmon,kp,mjx,mix)
    >where nyear, nmon, kp, mjx, mix are all scalars, like
    >
    >ua1 = fbinrecread (infile,2, (/nyear,nmon,kp,mjx,mix/),"float")
    >
    >to a variable xNew = onedtond( ndtooned(X), (/ntim,nlev,nlat,mlon/))
    >where nlat = dimsizes(lat2d) and mlon= dimsizes(lon2d).
    >
    > lat2d = fbinrecread (infile,0, (/mjx,mix/),"float")
    > lon2d = fbinrecread (infile,1, (/mjx,mix/),"float")
    >
    >I shall appreciate any ideas on how to do that since
    >xNew = onedtond( ndtooned(X), (/ntim,nlev,nlat,mlon/)) is wrong
    >because nlat and mlon are 2D while ntim and nlev are 1D?

    Presumably, the variable "ua1" is on the same grid as the
    lat2d/lon2d variables. Ie: for each year/month/level the
    mjx=nlat and the mix=mlon. Then

       ua1New = onedtond( ndtooned(ua1), (/ntim,nlev,nlat,mlon/))

    --- Something like

    dimensions:
            time = 120 ;
            nlon = 360 ;
            nlat = 240 ;
            lev = 40 ; ; kp
            
            integer time(time) ;
                    time:long_name = "time"
                    time:units = "yyyymm"
            float lev(lev) ;
                    lev:long_name = "pressure level"
                    lev:units = "hPa"

            float LAT2D(nlat, nlon)
                    LAT2D:long_name = "array of latitudes"
                    LAT2D:units = "degrees_north"
            float LON2D(nlat, nlon)
                    LON2D:long_name = "array of longitudes"
                    LON2D:units = "degrees_east"
                    
            float UA1(time, lev, nlat, nlon)
                    UA1:long_name = "Whatever UA1 is"
                    UA1:units = "?"
                    UA1:_FillValue = 1e+20f
                    TEMP:missing_value = 1e+20f
    ==========================================================

    >
    >Note that I cannot read lat2d and lon2d into 1D variables because
    >they do not repeat themselves.

    You can put lat2d and lon2d into 1D variables. That is not the
    problem. By definition, a netCDF *coordinate variable* is
    a one dimensional array that contains monotonically
    increasing or decreasing values. If you tried to assign
    the one dimensional versions of LAT2D and LON2D as
    coordinate variables the underlying netCDF software which
    NCL uses would reject them because they are not monotonic.

    good luck
    D

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



    This archive was generated by hypermail 2b29 : Mon Nov 01 2004 - 10:34:42 MST