[ncl-talk] Deleting multiple coordinate variables

Walter Hannah whannah at atmos.colostate.edu
Mon Nov 3 14:40:40 MST 2014


Hi,

I recently noticed a bug in NCL 6.2.0. Deleting a single coordinate 
variable works without an issue, but the newer method for deleting 
multiple items at once, does not work for coordinate variables. I've 
pasted a little NCL script below. If I'm not crazy, then the last 
printVarSummary() should show that the variable "z" stilll has two 
coordinate variables.

    begin
    ;===========================================================================================
    ;===========================================================================================
         line =
    "---------------------------------------------------------------------------"
         nx = 100
         ny = 100

         x = new(nx,double)
         y = new(ny,double)
         z = new((/ny,nx/),float)

         x = fspan(0,nx-1,nx)
         y = fspan(0,ny-1,ny)
         z = random_uniform(0,1,(/ny,nx/))

         z!0 = "y"
         z!1 = "x"
         z&y = y
         z&x = x
    ;===========================================================================================
    ;===========================================================================================
         print(""+line)
         print("Here's what z looks like:")
         print(""+line)
         printVarSummary(z)

         print(""+line)
         delete(z&y)
         print("The y-coord has been deleted")
         print(""+line)
         printVarSummary(z)

         print(""+line)
         z&y = y
         print("Now we have replaced the y-coord")
         print(""+line)
         printVarSummary(z)

         print(""+line)
         print("Now both x and y coords have been deleted (but they are
    still there!)")
         delete([/z&y,z&x/])
         print(""+line)
         printVarSummary(z)
    ;===========================================================================================
    ;===========================================================================================
    end


Thanks,
Walter Hannah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141103/4afb0b7d/attachment.html 


More information about the ncl-talk mailing list