Re: missing data

From: Mary Haley (haley@XXXXXX)
Date: Wed May 12 1999 - 14:05:25 MDT


> Hello-
>
> I am attempting to plot temperature data using ncl. The data
> is from a netcdf file converted from a ccm-formatted GENESIS
> history file. My problem is that there is a swath of missing
> data in the plot due probably to the absence of a longitudinal
> wrap (i.e., the addition of one longitudinal strip of temperature
> data). How have other users hurdled this obstacle? Is there an
> easy way to add a longitudinal wrap in ncl? Perhaps this is not
> the problem?
>
> An image of the temperature map, as well as the ncl script used to
> create the image, can be found at http://www.essc.psu.edu/~poulsen/
> ncl/problem.htm.
>
> Thanks for your help.
>
> Chris
>

Hi Chris,

There's a little NCL function called "add_cyclic_point" that we use to
make sure data wraps around properly. It makes a copy of the first
data point and tacks it onto the end of the data. This function
takes as input a 2D array and returns a 2D array with one more point in
the second dimension.

Let me know if you have any questions about it.

--Mary

function add_cyclic_point(data[*][*]:float)
;
; Add a cyclic point to a 2D array and return the new 2D array.
;
; For a lat/lon plot, "ny" corresponds to "nlat"
; "mx" corresponds to "mlon"
;
; New 2D array will be dimensioned "ny" x "mx+1"
;
local dims, newdata, ny, mx, mx1
begin
    dims = dimsizes(data)
    ny = dims(0)
    mx = dims(1)
    mx1 = mx+1
 
    newdata = new((/ny, mx1/),float)
 
    newdata(:,0:mx-1) = data ; Copy everything (incl. attributes)
    newdata(:,mx) = (/ data(:,0) /) ; Copy value only.
 
;
; If the second dimension has a named dimension, then we need to copy
; a value for it too.
;
    if((.not.ismissing(newdata!1)) .and. iscoord(data,newdata!1)) then
        newdata&$newdata!1$(mx) = newdata&$newdata!1$(0) + 360.0
    end if
 
    return(newdata)
end
 



This archive was generated by hypermail 2b29 : Wed Jun 28 2000 - 09:45:43 MDT