load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"   
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"    
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"  
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/popRemap.ncl"  
;************************************************
begin

  infile01  = addfile("./HadISST_sst.nc","r")
  tt        = cd_calendar(infile01->time,-1)
  tbn1      = ind(tt.eq.197001)
  tbn2      = ind(tt.eq.201812)
  sst       = lonFlip(infile01->sst(tbn1:tbn2,::-1,:))
  sst       = where(sst.eq.(-1000),sst@_FillValue,sst)
  printVarSummary(sst)

   yrstart = 1980
   yrlast  = 2010
   mostart = (yrstart-1970)*12
   molast  = (yrlast-1970)*12+11
   
  ssta = calcMonAnomTLL(sst,clmMonTLL(sst(mostart:molast,:,:)))
  printVarSummary(ssta)
  
  ; system("/bin/rm -f HadISST_ssta_1970_2018.nc")
  ; f = addfile("HadISST_ssta_1970_2018.nc","c")
  ; f->sst=ssta

  system("/bin/rm -f HadISST_ssta_1970_2018.nc")
  f = addfile("HadISST_ssta_1970_2018.nc","c")
  f->sst=ssta
  
  
end
