[ncl-talk] Issues adding variables to chart

Walter Kolczynski walter.kolczynski at noaa.gov
Fri May 8 09:37:27 MDT 2015


Whenever you try to add something to missing data, the result is still 
missing data. If you want to just use the values from var2 when var1 is 
missing, try using the where function:

var = where( ismissing(var1), var2, var1+var2 )

- Walter

On 07-May-15 10:13, BLIUJUS, STEVEN D CTR USAF AFMC AFLCMC/HBAW-OL wrote:
> I am trying to take two files and add the variables together. One variable
> has data over water while the other has missing values, when I try adding
> the values, nothing prints out for the areas over the ocean. I tried setting
> the variables to 0 instead of missing values but that did not work either. I
> have attached three images: var1, var2, and var. The variable var is the
> addition, and the addition gets done over land but not over water. Not sure
> why this is occurring, my only guess is the struggle with missing data.
> However, when I look at var, it doesn't look as though it is adding the
> variables properly either since the max for var is 2.49807, but the max for
> var2 is 2.544, so there is an obvious discrepancy. Here is my info:
>
> 1. I am using Version 6.1.2
> 2. My Script:
>
> load "/home/bliujuss/ncl/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "/home/bliujuss/ncl/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> load "/home/bliujuss/ncl/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> begin
>
> a=addfile("/home/bliujuss/Plots/MYD08_D3.051.timeAverage.1.nc","r")
> b=addfile("/home/bliujuss/Plots/MOD08_D3.051.timeAverage.0.nc","r")
> wks = gsn_open_wks("x11","plt_aod")
> gsn_define_colormap(wks,"3gauss")
>
> var1 = a->Deep_Blue_Aerosol_Optical_Depth_550_Land_QA_Mean(:,:)
> var2 = b->Optical_Depth_Land_And_Ocean_Mean(:,:)
>
> printVarSummary(var1)
> printMinMax(var1, True)
> printVarSummary(var2)
> printMinMax(var2, True)
>
>
> var = var1
> var = 0.0
> var = var2+var1
>
> printVarSummary(var)
> printMinMax(var, True)
>
> pltres = True
> pltres at tiMainString = "AOD550"
> pltres at cnFillOn = True
> pltres at gsnSpreadColors = False
> pltres at gsnAddCyclic = False
>
> pltres at cnLineLabelsOn = False
> pltres at cnLineLabelBackgroundColor = "white"
> ;plot = gsn_csm_contour_map_ce(wks,var({-46.2:46.5},{-4.5:184.5}),pltres)
> ;plot = gsn_csm_contour_map_ce(wks,var1({-46.2:46.5},{-4.5:184.5}),pltres)
> ;plot = gsn_csm_contour_map_ce(wks,var2({-46.2:46.5},{-4.5:184.5}),pltres)
> End
>
> 3. Files are attached
>
> 4. Images attached
>
> 5. No error message
>
> 6. gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)
>
>
>
> Steven Bliujus, Contractor
> SEMS/16WS WXE
> 557th Weather Wing
> DNS: 232-7151
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
Walter Kolczynski, Jr.
Global Ensemble Team
NOAA/NWS/NCEP/EMC (via I.M. Systems Group)
(301) 683-3781

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150508/c74afe75/attachment.html 


More information about the ncl-talk mailing list