[ncl-talk] Topography with GTOPO30 DATA

Gerardo Montoya gemonga at gmail.com
Mon Nov 7 12:00:42 MST 2016


Dear users, I introduced some changes in the script. topo_1.ncl, in order
to run it for high resolution elevation data (GTOPO30, tile E100N40.DEM).
However, some things I'm doing wrong or I'm missing, because the displayed
topography is not so good (see attached image). Also, the maximum height in
the domain appears to be 7213, i.e., about 273m higher than the maximum
peak in the Americas ( 6960m the Aconcagua´s peak in Argentina). I´m using
NCL version 6.3.0 and I´m running this program in a LENOVO Z580 laptop with
a i7 3520M processor.



I guess that the problem may be in the type of the variable “elev”, however
still now I don´t know how to solve it.  Any help for correcting the script
is greatly appreciated. The script is:


;================================================

; 2016-11-7  topo1km2V_0.ncl. It is a modified version of topo_1.ncl

;================================================

undef("read_elev_data")

function read_elev_data(topo_file)

local nlat, nlon, topo_file, lat, lon

begin

;---Read data as a straight binary file

  nlat =6000

  nlon = 4800

  setfileoption("bin","ReadByteOrder","BigEndian")

  elev = cbinread(topo_file,(/nlat,nlon/),"short")

;*******begin changes****************************************

;---Create 1D coordinate arrays

;  lat       = fspan(90,-90,nlat)

;  lon       = fspan(0,360,nlon)

res=0.00833333333333            ; this is the resolution of the GTOPO30
data.

ulat=39.99583333333333

ulon=-99.99583333333333

lat = ulat - ispan(0,(nlat-1),1)*res    ;from 39.99583333333333 to
-9.99583333331

lon = ulon+ispan(0,(nlon-1),1)*res   ;from -99.99583333333333 to
-60.00416666668

  lat at _FillValue=999.99

  lon at _FillValue=999.99

;*****end
changues*****************************************************************

  lat!0     = "lat"

  lon!0     = "lon"

  lat at units = "degrees_north"

  lon at units = "degrees_east"

  lat&lat   = lat

  lon&lon   = lon


;---Attach the coordinate arrays

  elev!0    = "lat"

  elev!1    = "lon"

  elev&lat  = lat

  elev&lon  = lon



  return(elev)

end


;----------------------------------------------------------------------

; Main code

;----------------------------------------------------------------------

begin

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

;**************begin changues**************************

setvalues NhlGetWorkspaceObjectId()

 "wsMaximumSize" : 300000000

 end setvalues

; the tile, E100N40.DEM was downloaded from:

; https://dds.cr.usgs.gov/srtm/version2_1/SRTM30/e100n40/

  elev = read_elev_data("/usr/local/Topog/E100N40.DEM")

  printVarSummary(elev)

  printMinMax (elev, False)

;*************************end changues*****************

;---Set some plot options

  res                    = True

  res at gsnMaximize        = True             ; maximize plot in frame

  res at cnFillOn           = True             ; turn on contour fill

  res at cnLevelSpacingF    = 125              ; NCL picks 2000

  res at cnFillMode         = "RasterFill"     ; much faster than AreaFill

  res at cnLinesOn          = False            ; turn off contour lines

  res at cnLineLabelsOn     = False            ; turn off line labels

  res at cnInfoLabelOn      = False            ; turn off info label

  res at lbBoxLinesOn       = False            ; turn off labelbar box lines

  res at gsnAddCyclic       = False            ; don't add longitude cyclic
point

  res at mpFillOn           = False            ; turn off map fill

  res at tiMainString       = "topo1km2V_0"     ; main title

  res at pmLabelBarWidthF   = 0.8              ; default is too short

;*************begin changues*************************

; set plot domain for the tile, E100N40.DEM

res at mpMinLatF           = -10.0

res at mpMaxLatF           =  40.0

res at mpMinLonF           = -100.0

res at mpMaxLonF           = -60.0

;************end changues***************************

  plot = gsn_csm_contour_map(wks,elev,res)

end

Thanks,

Gerardo Montoya

full professor (retired), Universidad Nacional de Colombia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161107/24e8a69e/attachment.html 
-------------- next part --------------
 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.

Variable: elev
Type: short
Total Size: 57600000 bytes
            28800000 values
Number of Dimensions: 2
Dimensions and sizes:	[lat | 6000] x [lon | 4800]
Coordinates: 
            lat: [39.99583..-9.995834]
            lon: [-99.99583..-60.00417]
(0)	min=-72   max=7213
-------------- next part --------------
A non-text attachment was scrubbed...
Name: topo1km2V_0.png
Type: image/png
Size: 239968 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161107/24e8a69e/attachment.png 


More information about the ncl-talk mailing list