[ncl-talk] Syntax error in addfile functon

Amit Kumar amitkumar.777 at hotmail.com
Tue May 16 03:29:24 MDT 2017


Hi all,

I'm trying to run a script but I'm getting following error in the addfile function itself. This is occuring to me first time, all other scripts having the same syntax are running fine. I don't know what is causing the syntax error.

*************************************************************************************************************************************
the scipt is attached below:

load "/usr/share/ncarg/nclscripts/csm/gsn_code.ncl"
load "/usr/share/ncarg/nclscripts/csm/gsn_csm.ncl"
load "/usr/share/ncarg/nclscripts/csm/contributed.ncl"

begin

 a = addfile("filename = "/home/amit/Desktop/Diff_2130_1700_SST.nc","r")

 ;filename = "/media/amit/E/India_shapefile/Districtbound(Satmet).shp"
 ;filename = "/media/amit/E/India_shapefile/State_bound(Satmet).shp"

  var     = doubletofloat(a->SST(:,:))
  lat     =  a->Latitude
  lon     =  a->Longitude
printVarSummary(var)
printVarSummary(lat)
printVarSummary(lon)
if (any(ismissing(ndtooned(lon)))) then
  print("Missing longitude coordinates detected")
end if
if (any(ismissing(ndtooned(lat)))) then
  print("Missing longitude coordinates detected")
end if

wks = gsn_open_wks("png","14MAY_2130_1700_Diff")                ; send graphics to PNG file

  res                      = True                  ; plot mods desired
  res at gsnDraw              = False
  res at gsnFrame             = False
  res at gsnAddCyclic         = False
  res at gsnStringFontHeightF = 0.015
  res at cnFillOn             = True                  ; turn on color fill
  res at cnFillMode = "RasterFill"
  res at trGridType = "TriangularMesh"
  res at cnRasterSmoothingOn = False
  res at gsnMaximize          = True     ; maximize plot in frame
  res at mpOutlineOn   = True   ; Use outlines from shapefile
  res at mpFillOn      = False
  res at cnLinesOn         = False    ; turn off contour lines
  res at cnLineLabelsOn    = False    ; turn off line labels
  res at cnLevelSelectionMode = "ExplicitLevels"
  res at cnLevels             = (/-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8/) ;   14 contour values
  res at cnFillPalette        = (/"Grey100","BlueViolet","Blue4","Blue2","Cornflowerblue","darkslategray1","Cyan"\
                ,"chartreuse","darkgreen","Yellow"\                     ; 15 contour colors
                              ,"Orange","darkorange4", "palevioletred1","orangered"    \
                              ,"Red3" /)

  res at lbLabelBarOn     = True
  res at lbOrientation   = "Vertical"
  res at sfXArray             = lon
  res at sfYArray        =  lat
  res at mpMinLonF     = 45.0
  res at mpMaxLonF     = 91.0
  res at mpMinLatF     = 8.0
  res at mpMaxLatF     = 26.0
  res at pmTickMarkDisplayMode     = "Always"
  ;res at tiXAxisString            = "Longitude"
  ;res at tiYAxisString            = "Lattitude"
  res at tiXAxisFontHeightF     = 0.02
  res at tiYAxisFontHeightF     = 0.02
plot = gsn_csm_contour_map(wks,var, res)        ; create plot

;---Resource list for shapefile outlines
; plres                     = True
; plres at gsLineColor       = "black"
; plres at gsLineThicknessF  = "1.0"
; dumstr                = unique_string("poly")
; id = gsn_add_shapefile_polylines(wks,plot,filename,plres)
 draw(plot)
 frame(wks)
end
******************************************************************************************************************************************


The error is


amit at amit:~/Desktop$ ncl sst_diff.ncl
 Copyright (C) 1995-2015 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.3.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
fatal:syntax error: line 7 in file sst_diff.ncl before or near .
 a = addfile("filename = "/home/amit/Desktop/Diff_2130_1700_SST.
---------------------------------------------------------------^

fatal:Syntax Error in block, block not executed
fatal:error at line 70 in file sst_diff.ncl


###################################################################################################

The information regarding data from ncl_filedump is attached here:

dimensions:
    x    = 1022
    y    = 391
    time    = 1 // unlimited

chunk dimensions:
    x    = 1022

variables:
    Variable: Longitude
    Type: double
    Total Size: 399602 values
                3196816 bytes
    Number of Dimensions: 2
    Dimensions and sizes:    [ 391 <y> x 1022 <x> ]
    Coordinates:
        Number of Attributes:        4
            standard_name    :     longitude
            long_name    :     longitude
            units    :     degrees_east
            _CoordinateAxisType    :     Lon

    Variable: Latitude
    Type: double
    Total Size: 399602 values
                3196816 bytes
    Number of Dimensions: 2
    Dimensions and sizes:    [ 391 <y> x 1022 <x> ]
    Coordinates:
        Number of Attributes:        4
            standard_name    :     latitude
            long_name    :     latitude
            units    :     degrees_north
            _CoordinateAxisType    :     Lat

    Variable: time
    Type: double
    Total Size: 1 values
                8 bytes
    Number of Dimensions: 1
    Dimensions and sizes:    [ 1 <time | unlimited> ]
    Chunking Info:    [ 524288 <time | unlimited> ]
    Coordinates:
                time: [9135210..9135210]
        Number of Attributes:        4
            standard_name    :     time
            units    :     minutes since 2000-1-1 00:00:00
            calendar    :     standard
            axis    :     T

    Variable: SST
    Type: float
    Total Size: 399602 values
                1598408 bytes
    Number of Dimensions: 3
    Dimensions and sizes:    [ 1 <time | unlimited> x 391 <y> x 1022 <x> ]
    Chunking Info:    [ 1 <time | unlimited> x 1 <y> x 1022 <x> ]
    Coordinates:
                time: [9135210..9135210]
        Number of Attributes:        6
            standard_name    :     Sea Surface Temperature
            long_name    :     Sea Surface Temperature
            units    :     K
            coordinates    :     Latitude Longitude
            _FillValue    :     -999
            missing_value    :     -999


###################################################################################################


my environment variable are


in my .bacshrc file


export NCARG_ROOT=/usr/local
export PATH=$NCARG_ROOT/bin:$PATH


amit at amit:~/Desktop$ ncl -V
6.3.0
amit at amit:~/Desktop$ which ncl
/usr/bin/ncl
amit at amit:~/Desktop$ env | grep NCARG
NCARG_ROOT=/usr/local
amit at amit:~/Desktop$ echo $NCARG_ROOT
/usr/local

******************************************************************************************************************************************


will be waiting for a reply.....


Regards

Amit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170516/631ff918/attachment-0001.html 


More information about the ncl-talk mailing list