<div dir="ltr"><div class="gmail_default" style="color:rgb(0,0,0)">Dear NCL users,<br><br></div><div class="gmail_default" style="color:rgb(0,0,0)">i am quite new to ncl, so i having a problem in plotting the trend of ocean heat. i am having my monthly data consists of time, latitude and level. There is no longitudes in my data. so i want to calculate the trend i.e. the map of regression coefficient in depth and latitudes and later on the significance test of this trend. <br></div><div class="gmail_default" style="color:rgb(0,0,0)">This is my script i am using to calculate the RC value.<br><br>;*************************************************
<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
<br> <br>begin
<br>;************************************************
<br>; create pointer to file and read in temperature
<br>;************************************************
<br> diri = "./"
<br> fili = "<a href="http://heat_gm.nc">heat_gm.nc</a>"
<br> in = addfile(diri+fili,"r")
<br>
<br> tmp = in->HEAT_G
<br> printVarSummary(tmp)
<br> ts = tmp(LEV |:, LAT28_153 |:, TIME |:)<br><br>delete(tmp) ; no longer needed
<br> <br>;************************************************
<br>; create x and calculate the regression coefficients (slopes, trends)
<br>;************************************************
<br> time = ts&TIME ; days since 1850-01-01
<br> ;time=ispan(1, 1800, 1)
<br> rc = regCoef(time,ts)
<br> <br>;************************************************
<br>; for illustration: change units to j/m^2/year
<br>;***********************************************
<br> <br> rc@long_name = "regression coefficient (trend)"
<br> copy_VarCoords(ts(:,:,0), rc) ; copy lat,lon coords
<br> rc = rc*365 ; (Pa/day)*(365_day/year)
<br> rc@units = "j/m^2/year"
<br> <br> tval = onedtond(rc@tval , dimsizes(rc))
<br> df = onedtond(rc@nptxy, dimsizes(rc)) - 2
<br> b = tval ; b must be same size as tval (and df)
<br> b = 0.5
<br> prob = 1-betainc(df/(df+tval^2),df/2.0,b) ; prob(nlat,nlon)
<br> copy_VarCoords(rc, prob)
<br>
<br> rc@long_name = "regression coefficient"
<br> prob@long_name = "probability"
<br> printVarSummary(prob)
<br> printVarSummary(rc)<br><br>;************************************************
<br>; plotting parameters
<br>;************************************************
<br> wks = gsn_open_wks("png" ,"regress_t-test_test")
<br> ;gsn_define_colormap(wks,"ViBlGrWhYeOrRe") ; choose colormap
<br>
<br> res = True
<br> res@gsnFrame=False
<br> res@gsnDraw=False
<br> ;res@gsnMaximize = True ; make large
<br> <br> res@cnFillOn = True ; turn on color
<br> res@cnLinesOn = False ; turn off contour lines
<br> res@cnLineLabelsOn = False ; turn off contour line labels
<br> ;;res@cnFillMode = "RasterFill"
<br> <br> res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
<br> res@cnMinLevelValF = -5 ; set min contour level
<br> res@cnMaxLevelValF = 5 ; set max contour level
<br> res@cnLevelSpacingF = 1 ; set contour interval
<br> <br> ;res@mpFillOn = False ; turn off default background gray
<br> ;res@mpCenterLonF = 210
<br>
<br> res@tiMainString = fili
<br> plot = gsn_csm_contour_map(wks,rc,res)
<br> <br>prob_p=where (prob.ge.0.95,1,0)
<br>copy_VarCoords(prob, prob_p)
<br>;print(prob_p)
<br>rescn=True
<br>rescn@gsnFrame=False
<br>rescn@gsnDraw=False
<br>rescn@cnLevelSelectionMode = "ManualLevels"
<br>rescn@cnMinLevelValF = -0.5
<br>rescn@cnMaxLevelValF = 1.5
<br>rescn@cnLevelSpacingF = 1.
<br>rescn@cnFillOn = True
<br> rescn@cnMonoFillColor = True
<br> rescn@cnMonoFillPattern = False
<br> rescn@cnConstFEnableFill = False
<br> rescn@cnFillScaleF = 0.55
<br> rescn@cnFillDotSizeF = 0.002
<br> rescn@cnFillColor = "black"
<br> rescn@cnFillPatterns = (/-1,-1,17,-1/)
<br> rescn@cnLinesOn = False
<br> rescn@lbLabelBarOn =False
<br> rescn@cnInfoLabelOn = False
<br> ;rescn@cnInfoLabelFont = 21
<br> <br>;rescn@mpCenterLonF = 210
<br>plotB=gsn_csm_contour(wks,prob_p,rescn)
<br> <br>overlay(plot, plotB)
<br>draw(plot)
<br>frame(wks)
<br>end<br><br><br><br></div><div class="gmail_default" style="color:rgb(0,0,0)">After running this script i am getting this error<br><br><br><br clear="all"></div><div style="color:rgb(0,0,0)" class="gmail_default">Variable: tmp<br>Type: double<br>Total Size: 3864672 bytes<br> 483084 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [TIME | 142] x [LEV | 27] x [LAT28_153 | 126]<br>Coordinates: <br> TIME: [731962..736253]<br> LEV: [ 0..2000]<br> LAT28_153: [-62.5..62.5]<br>Number Of Attributes: 5<br> missing_value : -9.999999999999999e+33<br> _FillValue : -9.999999999999999e+33<br> long_name : HEAT_ANM_ALL[X=@DIN]/10^10<br> long_name_mod : X=0E:0E(360)<br> history : From heat_anm_all<br><br>Variable: prob<br>Type: double<br>Total Size: 27216 bytes<br> 3402 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [LEV | 27] x [LAT28_153 | 126]<br>Coordinates: <br> LEV: [ 0..2000]<br> LAT28_153: [-62.5..62.5]<br>Number Of Attributes: 1<br> long_name : probability<br><br>Variable: rc<br>Type: double<br>Total Size: 27216 bytes<br> 3402 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [LEV | 27] x [LAT28_153 | 126]<br>Coordinates: <br> LEV: [ 0..2000]<br> LAT28_153: [-62.5..62.5]<br>Number Of Attributes: 7<br> units : j/m^2/year<br> long_name : regression coefficient<br> _FillValue : -9.999999999999999e+33<br> nptxy : <ARRAY of 3402 elements><br> rstd : <ARRAY of 3402 elements><br> yintercept : <ARRAY of 3402 elements><br> tval : <ARRAY of 3402 elements><br>(0) check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.<br>(0) A valid latitude coordinate array should have a 'units' attribute equal to one of the following values: <br>(0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'<br>(0) check_for_lon_coord: Warning: Data either does not contain a valid longitude coordinate array or doesn't contain one at all.<br>(0) A valid longitude coordinate array should have a 'units' attribute equal to one of the following values: <br>(0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'<br>warning:ContourPlotDraw: out of range coordinates encountered; standard AreaFill rendering method may be unreliable;<br> consider setting the resource trGridType to "TriangularMesh" if coordinates contain missing values</div><br><br><div style="color:rgb(0,0,0)" class="gmail_default">please help me out as there is no such link in ncl user list to get rid of this problem. i want a plot of my regression coefficient variable in depth and latitude .<br><br></div><div style="color:rgb(0,0,0)" class="gmail_default">regards, saurabh<br></div><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><font color="#0000ff" size="4"><b><br></b></font></div><div><font color="#0000ff" size="4"><b><br></b></font></div><font color="#0000ff" size="4" face="times new roman, serif"><b>REGARDS</b></font><div><font color="#0000ff" size="4" face="times new roman, serif"><b><br></b></font><div><font color="#0000ff" size="4" face="times new roman, serif"><b>Saurabh Rathore</b></font></div><div><font color="#0000ff" size="4" face="times new roman, serif"><b>Research Scholar (PhD.)</b></font></div><div><font color="#0000ff" size="4" face="times new roman, serif"><b>Centre For Oceans, Rivers, Atmosphere & Land Science Technology</b></font></div><div><font color="#0000ff" size="4" face="times new roman, serif"><b>Indian Institute Of Technology, Kharagpur</b></font></div><div><font color="#0000ff" size="4" face="times new roman, serif"><b>contact :- 91- 8345984434</b></font></div></div></div></div></div></div>
</div>