Cathy,
Preallocate an array to store the difference, then use (/   /) to not 
transfer (or in this case destroy) metadata on the left hand side of the 
= sign:
LH_diff = LH(0,:,:)	;preallocate array with lat,lon metadata
LH_diff = (/ LH(0,:,:) - LHOI(0,:,:) /)		;only transfer data from 			 
;right hand side to left hand side
Adam
Cathryn Meyer wrote:
> Hello,
> 
> I am using gsn_csm_contour_map_ce to create contour plots.  I am reading
> in variables from a netcdf file from running CAM3.1.  If I just read in
> some variables and plot them using gsn_csm_contour_map_ce, everything
> works fine, however I need to difference some variables that I am
> reading in.  After I subtract the variables and store their difference
> in a new variable and attempt to plot that, I get the following error
> messages:
> -----------------------------------------------------
> (0)     check_for_y_lat_coord: Warning: Data either does not contain a
> valid latitude coordinate array or doesn't contain one at all.
> (0)     A valid latitude coordinate array should have a 'units'
> attribute equal to one of the following values:
> (0)         'degrees_north' 'degrees-north' 'degree_north' 'degrees
> north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN'
> (0)     check_for_lon_coord: Warning: Data either does not contain a
> valid longitude coordinate array or doesn't contain one at all.
> (0)     A valid longitude coordinate array should have a 'units'
> attribute equal to one of the following values:
> (0)         'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
> 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE'
> ----------------------------------------------------
> 
> I am not sure how to carry the lat/lon coords and their units through
> the subtraction of the variables.  Here is what I've been doing so far:
> 
> ---------------------------------------------------------
> 
>  load "/usr/local/NCL/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>  load "/usr/local/NCL/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>  load "/usr/local/NCL/lib/ncarg/nclscripts/csm/contributed.ncl"
>                                                                        
>         
>                                                                        
>      
>  datafile_TPLIO =
> "/mnt/usb-drive/ccm33/alexeyruns/TPLIO_11yrs/camrun_TPLIO_11yrs.cam2.h0.0000-09.nc"
>                                                                        
>         
> ;*************************************************************************
>                                                                        
>         
>    fils = systemfunc ("ls
> /mnt/usb-drive/ccm33/alexeyruns/TPLIO_11yrs/camrun_TPLIO_11yrs.cam2.h0.*")
>    f    = addfiles (fils+".nc", "r")
>    LH   = addfiles_GetVar (f, fils, "LHFLX")
>    FL   = addfiles_GetVar (f, fils, "FLNS")
>    FS   = addfiles_GetVar (f, fils, "FSNS")
>    LHOI   = addfiles_GetVar (f, fils, "LHFLXOI")
>    FLOI   = addfiles_GetVar (f, fils, "FLNSOI")
>    FSOI   = addfiles_GetVar (f, fils, "FSNSOI")
>    mfile = addfile (datafile_TPLIO, "r")
> ;*************************************************************************
>                                                                        
>         
>      wks = create "fluxWork" psWorkstationClass defaultapp
>         "wkPSFileName" : "./lhcompare.ps"
>       end create
>                                                                        
>         
>   gsn_define_colormap(wks,"ncview_default")
>                                                                        
>         
>   plots = new(3,graphic)  ; Create variable to hold plots.
>                                                                        
>         
> ;***********************************************************************
>                                                                        
>         
>  LH_diff = LH(0,:,:) - LHOI(0,:,:)                                     
>                                           
> 
>  resources = True
>  resources@gsnFrame = False
>  resources@gsnDraw = False
>  resources@cnFillOn = True
>  resources@cnInfoLabelOn = True 
>  resources@cnLinesOn = True
>  resources@gsnSpreadColors = True
>  resources@cnLevelSelectionMode = "ManualLevels"
>  resources@cnLevelSpacingF = 20.  
>  resources@mpCenterLonF = 180.0
>                                                                        
>           resources@cnMinLevelValF = -40.
>   resources@cnMaxLevelValF =  160.
>   plots(0) = gsn_csm_contour_map_ce(wks,LH(0,:,:),resources)
>                                                                        
>         
>   resources@tiMainString = "LHFLXOI"
>   plots(1) = gsn_csm_contour_map_ce(wks,LHOI(0,:,:),resources)
>                                                                        
>                                                                        
>               
>   resources@cnMinLevelValF = -5.0
>   resources@cnMaxLevelValF = 5.0
>   resources@cnLevelSpacingF = 1.0
>   resources@tiMainString = "Difference"
>   plots(2) = gsn_csm_contour_map_ce(wks,LH_diff(:,:),resources)
>                                                                        
>         
>   pres1                      = True
>   pres1@gsnFrame             = False
>                                                                        
>         
>   gsn_panel(wks,plots,(/3,1/),pres1)
> 
> 
> --------------------------------------------------------------------
> 
> Thanks,
> Cathy
> 
-- -------------------------------------------------------------- Adam Phillips asphilli@ucar.edu National Center for Atmospheric Research tel: (303) 497-1726 ESSL/CGD fax: (303) 497-1333 P.O. Box 3000 Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli _______________________________________________ ncl-talk mailing list ncl-talk@ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Thu Apr 21 2005 - 10:03:07 MDT