<div dir="ltr"><div class="gmail_default" style="font-size:small">If you want help with a script, it helps if you can provide a *clean* script that demonstrates the problem, rather than a long script where we have no idea what line number the error is occurring on.  It&#39;s very time-consuming for us to look through scripts like this, especially when we can&#39;t execute them.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">My guess is that the problem is with this line:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">t_test_plot                    = gsn_csm_contour(wks,alphat,</span><span style="font-size:12.8px">rest_test)</span><br style="font-size:12.8px"></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">If &quot;alphat&quot; is a 1D array, then NCL will see this as &quot;unstructured&quot; data, and in order to draw contours in a rectangular data space, you need to provide X and Y coordinate locations of each point.  That&#39;s why you are getting an error saying that you need to set sfXArray and sfYArray.  For more information on contouring 1D data, see:</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default"><span style="font-size:12.8px"><a href="http://www.ncl.ucar.edu/Applications/contour1d.shtml" target="_blank">http://www.ncl.ucar.edu/Applications/contour1d.shtml</a></span><br></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default"><span style="font-size:12.8px">I&#39;m not sure if you really meant to contour a 1D array, however. You may need to recheck that you are doing your calculations correctly.</span></div><div class="gmail_default"><span style="font-size:12.8px"><br></span></div><div class="gmail_default"><span style="font-size:12.8px">--Mary</span></div><div class="gmail_default"><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 26, 2015 at 12:22 PM, Moustapha Tall <span dir="ltr">&lt;<a href="mailto:tall.moustapha89@gmail.com" target="_blank">tall.moustapha89@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Moustapha Tall</b> <span dir="ltr">&lt;<a href="mailto:tall.moustapha89@gmail.com" target="_blank">tall.moustapha89@gmail.com</a>&gt;</span><br>Date: 2015-10-26 16:17 GMT+00:00<br>Subject: problem with plotting &quot;t-test&quot; pattern with precipitation change<br>To: <a href="mailto:ncl-talk-request@ucar.edu" target="_blank">ncl-talk-request@ucar.edu</a><br><br><br><div dir="ltr"><div> Hi NCL webmasters and all,<br></div>I am tryning to plot the mid-century precipitation change for<br><div>a given model, thus plotting the rainfall change patterns with &quot;stippling&quot; where <br>they are statistically significant at the 95 percent confidence level (based on a t-test). <br></div><div>I get this message: <br>(0)    Error: scalar_field: If the input data is 1-dimensional, you must set sfXArray and sfYArray to 1-dimensional arrays of the same length.<br>warning:create: Bad HLU id passed to create, ignoring it<br><br></div><div>My script is below,<br><br>;**************************************************************************************<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br><br>begin<br>  <br>;*****************************************************************************************<br>; Creating Function to Read at once Precip and Convert Calendar to Human Readable YYYYMM<br>;*****************************************************************************************<br><br>   undef(&quot;getPrecip&quot;)<br>   function getPrecip(fname[1]:string, vname[1]:string)<br>   <br>   begin<br>     f       = addfile(fname, &quot;r&quot;)<br>   <br>     x       = f-&gt;$vname$(0,:,:)  ; read specified time period <br>   <br>   return(x)<br>   end<br>;*****************************************************************************************<br>; Reading Precip for each File for the Defined Period ymStrt -  ymLast<br>;***************************************************************************************** <br>   <br>   gcmpre1 = getPrecip(&quot;remap_reg_jjas_mm_mmean_EC-EARTH_1976-2005.nc&quot;,&quot;pr&quot;)<br> <br>   gcmfut1 = getPrecip(&quot;remap_pr_wafr_jjas_EC-EARTH_rcp45_2021-2050.nc&quot;,&quot;pr&quot;)<br> <br> ;*******************************************************************************<br>;Taking JJAS difference<br>;*******************************************************************************<br>    <br>  diff1 = gcmfut1 - gcmpre1<br>  diff1 = 100*diff1/mask(gcmpre1,(gcmpre1.ge.0.9),True)<br>  diff1@long_name = &quot; RCP4.5 - Present JJAS Precipitation (%)&quot;<br>  diff1@units = &quot; &quot;<br>  printVarSummary(diff1)             ; print a summary of the variable<br>  copy_VarCoords(gcmpre1,diff1)<br>;************************************************************************************************************<br>; Create graphic array for panel plot and Open a Work Station<br>;************************************************************************************************************<br><br>   plots = new(1,graphic)                              ; Open a variale plots to store 4 Figures<br>   wks = gsn_open_wks(&quot;ps&quot;,&quot;Precip_JJAS_Change&quot;)             ; open a workstation<br>   gsn_define_colormap(wks, &quot;CBR_drywet&quot;) <br>   <br>;*************************************************************************************************************<br>; Create plots options<br>;*************************************************************************************************************<br>   <br>     res                      = True               ; plot options desired<br>   res@gsnSpreadColors      = True               ; span full colormap<br>   res@gsnDraw              = False              ; don&#39;t draw<br>   res@gsnFrame             = False              ; don&#39;t advance frame<br>   res@cnFillOn             = True               ; turn on color fill<br><br>   res@cnLevelSelectionMode = &quot;ExplicitLevels&quot;                         ; set explicit contour levels<br>   res@cnLevels             = (/-75.,-50.,-25.,-10.,-5.,5.,10.,25.,50.,75./)<br>   <br>   res@cnLinesOn            = False              ; turn off contour lines<br>   res@cnLineLabelsOn       = False              ; turn off the values that would be on the contours<br>   res@mpFillOn             = False              ; turn off gray continents<br>   res@gsnMaximize          = True               ; Use the full page<br>   res@gsnPaperOrientation  = &quot;portrait&quot;         ; Change orientation   <br>   res@mpProjection         = &quot;Mercator&quot;<br>   res@mpLimitMode          = &quot;LatLon&quot;<br>   res@gsnAddCyclic         =  False             ; Regional data<br>;   res@mpMaxLatF           =  max(latitude)         ; Taking the whole domain<br>;   res@mpMinLatF           =  min(latitude)<br>;   res@mpMaxLonF           =  max(longitude)<br>;   res@mpMinLonF           =  min(longitude)<br><br>   res@mpMaxLatF            =   25.0             ; Zoom in West Africa<br>   res@mpMinLatF            =   -5.0<br>   res@mpMaxLonF            =   25.0<br>   res@mpMinLonF            =  -25.0<br><br>   res@mpOutlineBoundarySets       = &quot;National&quot;        ; Display the conutries borders<br>   res@mpOutlineOn = True                        ; Turn on the outline of the map<br>   res@mpGeophysicalLineThicknessF = 3.0         ; Increase the thickness of map border<br>   res@pmTickMarkDisplayMode       = &quot;Always&quot;          ; Turn on map tickmarks, i.e. writing lons and lats along the axes<br>   res@lbLabelBarOn                = False               ; turn off individual colorbars<br>;*********************************************************************************************************************<br>; Changing the font seize<br>;*********************************************************************************************************************<br>    res@tmXBLabelFontHeightF = 0.02                  ; resize tick labels for X axis<br>    res@tmYLLabelFontHeightF = 0.02                  ; resize tick labels for Y axis<br>                                                     ; change label spacing to avoid overlap<br>    ;res@lbLabelStride    = 1                         ; and write every other label<br>    res@lbLabelFontHeightF = 0.018                   ; change the size of the label bar<br>   ;res@tiMainString         = &quot;1st Plot Test&quot;       ; Provide a main Tile<br><br>    res@gsnStringFontHeightF = 0.025                 ; Increase the title font size (long_name)<br>   <br>;*******************************************************************************************************<br>; setting and  plotting the t-test significance<br>;*******************************************************************************************************<br>aveX = dim_avg_n_Wrap(gcmpre1,0)  ; average over the 0th dim<br>varX = dim_variance_n_Wrap(gcmpre1,0) ; compute variance<br>     printVarSummary(aveX)<br>     printVarSummary(varX) <br>aveY = dim_avg_n_Wrap(gcmfut1,0)  ; average over the 0th dim<br>varY = dim_variance_n_Wrap(gcmfut1,0) ; compute variance<br>     printVarSummary(aveY)<br>     printVarSummary(varY)<br>sX   = dimsizes (aveX)<br>sY   = dimsizes (aveY)        ; different sizes<br>alphat = 100.*(1. -ttest(aveX,varX,sX, aveY,varY,sY, False, False))<br>;;;;;;;;;;;;;creating ressources for T-TEST;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>rest_test                      = True               ; plot options desired<br>rest_test@gsnSpreadColors      = True               ; span full colormap<br>rest_test@gsnDraw              = False              ; don&#39;t draw<br>rest_test@gsnFrame             = False              ; don&#39;t advance frame<br>rest_test@cnFillOn             = True               ; turn on color fill    <br>rest_test@lbLabelBarOn         = False               ; turn off individual colorbars<br>rest_test@cnLinesOn             = False               ; turn off individual colorbars<br>rest_test@cnLineLabelsOn      = False               ; turn off individual colorbars<br>rest_test@cnInfoLabelOn        = False               ; turn off individual colorbars<br>rest_test@cnLevelSpacingF      = 0.05               <br>rest_test@cnFillDotSizeF       = 0.004<br>t_test_plot                    = gsn_csm_contour(wks,alphat,rest_test)<br>opt_t_test                     = True<br>opt_t_test@gsnShadeFillType    = &quot;Pattern&quot;<br>opt_t_test@gsnShadeLow         = 17<br>plot_t_test_plot               = gsn_contour_shade(t_test_plot,0.05,999.,opt_t_test)<br>;*******************************************************************************************************<br>; Displaying the Panel Plot<br>;*******************************************************************************************************<br><br>    plots(0) = gsn_csm_contour_map(wks,diff1,res)<br>   <br>    overlay(plots(0), plot_t_test_plot)<br><br>    pnlres = True                                            ; Add panel options<br>    pnlres@gsnFrame     = False                              ; Don&#39;t frame yet<br>   ;pnlres@txString   = &quot;Default X and Y positions of all plots&quot; ; add main title for the panel<br>    pnlres@gsnPanelLabelBar  = True                          ; Setting a common colorbar<br>    pnlres@lbLabelFontHeightF  = 0.02                        ; Increase font size of the numbers in the label bar<br>    pnlres@pmLabelBarWidthF    = 0.9                          ; label bar width<br>    pnlres@pmLabelBarHeightF   = 0.08                        ; label bar height<br>    pnlres@pmLabelBarOrthogonalPosF = 0.002                  ; move the labelbar up and down<br>    pnlres@pmLabelBarParallelPosF   = 0.03                   ;move the labelbar left or right<br>    pnlres@lbLabelStride    = 1                                 ; and write every other label<br>;    pnlres@lbLabelAutoStride = True                          ; Optimal labels, i.e. avoid overlap<br>    pnlres@gsnPanelDebug     = True                          ; To get information from panel<br>    pnlres@gsnPanelFigureStrings= (/&quot;a)&quot;/)   ; add strings to panel<br>    pnlres@gsnPanelFigureStringsFontHeightF  = 0.016          ; Increase the size of these strings<br>    pnlres@gsnPanelFigureStringsPerimOn              = False        ; Remove the box around these strings <br>    pnlres@amJust   = &quot;TopLeft&quot;                              ; Where to put these strings<br>    pnlres@gsnPanelYWhiteSpacePercent = 5                    ; Adds the white space to the panel plot<br>    pnlres@gsnPanelXWhiteSpacePercent = 5                    ; Adds the white space to the panel plot <br>    pnlres@gsnPanelTop                = 1.<br>    pnlres@gsnPanelBottom             = 0.  <br>  gsn_panel(wks,plots,(/1,1/),pnlres)<br><br>end<br>;**************************************************************************************<br></div><div> and <br><br>Variable: diff1<br>Type: float<br>Total Size: 33600 bytes<br>            8400 values<br>Number of Dimensions: 2<br>Dimensions and sizes:    [70] x [120]<br>Coordinates: <br>Number Of Attributes: 3<br>  units :     <br>  long_name :     RCP4.5 - Present JJAS Precipitation (%)<br>  _FillValue :    1e+20<br><br><br>Variable: aveX<br>Type: float<br>Total Size: 480 bytes<br>            120 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [lon | 120]<br>Coordinates: <br>            lon: [-29.75..29.75]<br>Number Of Attributes: 12<br>  associated_files :    baseURL: <a href="http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation" target="_blank">http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation</a> gridspecFile: gridspec_atmos_fx_EC-EARTH_historical_r0i0p0.nc areacella: areacella_fx_EC-EARTH_historical_r0i0p0.nc<br>  history :    2012-05-10T11:28:56Z altered by CMOR: replaced missing value flag (1e+28) with standard missing value (1e+20). 2012-05-10T11:28:56Z altered by CMOR: Converted type from &#39;d&#39; to &#39;f&#39;. 2012-05-10T11:28:56Z altered by CMOR: Inverted axis: lat.<br>  cell_methods :    time: mean (interval: 3 hours)<br>  original_name :    TP=LSP+CP<br>  comment :    at surface; includes both liquid and solid phases from all types of clouds (both large-scale and convective)<br>  missing_value :    1e+20<br>  _FillValue :    1e+20<br>  units :    kg m-2 s-1<br>  long_name :    Precipitation<br>  standard_name :    precipitation_flux<br>  time :    7699.5<br>  average_op_ncl :    dim_avg_n over dimension(s): lat<br><br>Variable: varX<br>Type: float<br>Total Size: 480 bytes<br>            120 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [lon | 120]<br>Coordinates: <br>            lon: [-29.75..29.75]<br>Number Of Attributes: 12<br>  associated_files :    baseURL: <a href="http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation" target="_blank">http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation</a> gridspecFile: gridspec_atmos_fx_EC-EARTH_historical_r0i0p0.nc areacella: areacella_fx_EC-EARTH_historical_r0i0p0.nc<br>  history :    2012-05-10T11:28:56Z altered by CMOR: replaced missing value flag (1e+28) with standard missing value (1e+20). 2012-05-10T11:28:56Z altered by CMOR: Converted type from &#39;d&#39; to &#39;f&#39;. 2012-05-10T11:28:56Z altered by CMOR: Inverted axis: lat.<br>  cell_methods :    time: mean (interval: 3 hours)<br>  original_name :    TP=LSP+CP<br>  comment :    at surface; includes both liquid and solid phases from all types of clouds (both large-scale and convective)<br>  missing_value :    1e+20<br>  _FillValue :    1e+20<br>  units :    kg m-2 s-1<br>  long_name :    Precipitation<br>  standard_name :    precipitation_flux<br>  time :    7699.5<br>  variance_op_ncl :    dim_variance_n over dimension(s): lat<br><br>Variable: aveY<br>Type: float<br>Total Size: 480 bytes<br>            120 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [lon | 120]<br>Coordinates: <br>            lon: [-29.75..29.75]<br>Number Of Attributes: 12<br>  associated_files :    baseURL: <a href="http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation" target="_blank">http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation</a> gridspecFile: gridspec_atmos_fx_EC-EARTH_rcp45_r0i0p0.nc areacella: areacella_fx_EC-EARTH_rcp45_r0i0p0.nc<br>  history :    2012-03-19T15:13:27Z altered by CMOR: replaced missing value flag (1e+28) with standard missing value (1e+20). 2012-03-19T15:13:27Z altered by CMOR: Inverted axis: lat.<br>  cell_methods :    time: mean (interval: 3 hours)<br>  original_name :    TP=LSP+CP<br>  comment :    at surface; includes both liquid and solid phases from all types of clouds (both large-scale and convective)<br>  missing_value :    1e+20<br>  _FillValue :    1e+20<br>  units :    kg m-2 s-1<br>  long_name :    Precipitation<br>  standard_name :    precipitation_flux<br>  time :    10987<br>  average_op_ncl :    dim_avg_n over dimension(s): lat<br><br>Variable: varY<br>Type: float<br>Total Size: 480 bytes<br>            120 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [lon | 120]<br>Coordinates: <br>            lon: [-29.75..29.75]<br>Number Of Attributes: 12<br>  associated_files :    baseURL: <a href="http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation" target="_blank">http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation</a> gridspecFile: gridspec_atmos_fx_EC-EARTH_rcp45_r0i0p0.nc areacella: areacella_fx_EC-EARTH_rcp45_r0i0p0.nc<br>  history :    2012-03-19T15:13:27Z altered by CMOR: replaced missing value flag (1e+28) with standard missing value (1e+20). 2012-03-19T15:13:27Z altered by CMOR: Inverted axis: lat.<br>  cell_methods :    time: mean (interval: 3 hours)<br>  original_name :    TP=LSP+CP<br>  comment :    at surface; includes both liquid and solid phases from all types of clouds (both large-scale and convective)<br>  missing_value :    1e+20<br>  _FillValue :    1e+20<br>  units :    kg m-2 s-1<br>  long_name :    Precipitation<br>  standard_name :    precipitation_flux<br>  time :    10987<br>  variance_op_ncl :    dim_variance_n over dimension(s): lat<br>(0)    Error: scalar_field: If the input data is 1-dimensional, you must set sfXArray and sfYArray to 1-dimensional arrays of the same length.<br>warning:create: Bad HLU id passed to create, ignoring it<br><br></div><div><br></div><div>Can anyone help me for that!<br><br><br></div><div>cheers<span class="HOEnZb"><font color="#888888"><span><font color="#888888"><br></font></span></font></span></div><span class="HOEnZb"><font color="#888888"><span><font color="#888888"><div><br></div><div><br>-- <br><br>
</div></font></span></font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div><div dir="ltr"><div><div><div>Tall Moustapha,<br></div>Laboratoire de Physique de l&#39;Atmosphère et de l&#39;Océan Siméon-Fongang (LPAO-SF)<br></div>École Supérieure Polytechnique (ESP) / Université Cheikh Anta DIOP (UCAD) <br></div><div>BP: 5085 Dakar fann ; Fax : <a href="tel:%28%2B221%29%2033%20825%2093%2064" value="+221338259364" target="_blank">(+221) 33 825 93 64</a><br>Tel perso : <a href="tel:%28%2B221%29%2077%20730%2080%2011" value="+221777308011" target="_blank">(+221) 77 730 80 11</a><br>Dakar / Sénégal<br><br></div></div></div>
</font></span></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>