;---------------------------------------------------------------------- ; dataonmap_5.ncl ; ; Concepts illustrated: ; - Contouring one-dimensional X, Y, Z data ;---------------------------------------------------------------------- ; These files are loaded by default in NCL V6.2.0 and newer ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm_tao.ncl" begin ; ; Data is stored in four columns: station_name lat lon pwv ; Read in each line as a string, use "str_get_field" to ; read in the fields of interest and "tofloat" to convert ; to float. ; ; read ascii data---------------------------------------------------------------------------- lines = asciiread("./crain_composite_2015.09.09.00.00_UTC",-1,"string") ; read ndata ndata_raw = str_get_field(lines(0),5,":") ndata_split = str_split(ndata_raw, "=") ndata = toint(ndata_split(1)) print (ndata) ; read time of UTC time = str_get_field(lines(1),2," ") print (time) ; read data radar_raw = tofloat(str_get_field(lines(2:),1," ")) radar = radar_raw ;reshape(radar_raw,(/nt,nlocation/)) ;radar = reshape(radar_raw,(/nt,nloc_sqrt,nloc_sqrt/)) lat_raw = todouble(str_get_field(lines(2:),2," ")) lat = lat_raw ;lat_raw(0:nlocation-1) lon_raw = todouble(str_get_field(lines(2:),3," ")) lon = lon_raw ;lon_raw(0:nlocation-1) ; end read ascii data---------------------------------------------------- print (max(lat)) print (max(lon)) print (max(radar)) print (dimsizes(radar)) print (dimsizes(lat)) print (dimsizes(lon)) ;print (lat(0:39)) ;print (lon(0:39)) ;print (radar(0:39)) ;print (dimsizes(time)) type = "x11" ;type@wkBackgroundColor = "grey40" type@wkWidth = 1500 ; Increase size for a slightly type@wkHeight = 1500 ; better looking PNG. wks = gsn_open_wks(type,"./test_complex") do nt = 0, 0, 1 ; map plot------------------------------------------------------------------------------------ mpres = True mpres@gsnFrame = False mpres@gsnDraw = False ; title mpres@tiMainString = time mpres@tiMainFont = 0 mpres@tiMainFontColor = "Black" mpres@tiMainFontHeightF = 0.035 ; outline ; fill color mpres@mpLandFillColor = "LightGrey" ; viewport ;mpres@vpKeepAspect = False ;mpres@vpXF = 0.02 ;mpres@vpYF = 0.87 ;mpres@vpWidthF = 0.98 ;mpres@vpHeightF = 0.72 ; zoom in map mpres@mpMinLatF = 20.0 mpres@mpMaxLatF = 50.0 mpres@mpMinLonF = 120 mpres@mpMaxLonF = 150 ; map plot map = gsn_csm_map(wks,mpres) ; add shapefile to map pres = True pres@gsLineThicknessF = 4.0 pres@gsLineColor = "White" shp_kinu = "/home/debian/WRF/CASES/kinugawa/shp/kinugawa.shp" poly_kinu = gsn_add_shapefile_polylines(wks,map,shp_kinu,pres) shp_tone = "/home/debian/WRF/CASES/kinugawa/shp/tonegawa.shp" poly_tone = gsn_add_shapefile_polylines(wks,map,shp_tone,pres) ; end map plot------------------------------------------------------------- res = True res@gsnFrame = False res@gsnDraw = False res@tiMainString = time res@gsnMaximize = True res@cnFillOn = True res@cnLinesOn = False res@cnLevelSelectionMode = "ExplicitLevels" res@cnLevels = (/0.1, 5, 20, 50, 75, 100, 150, 210/) res@cnFillColors = (/"transparent","cadetblue","blue3","chartreuse4", \ "gold","darkorange","lightpink", "brown2","blueviolet"/) res@cnFillOpacityF = 0.80 ; partially transparent res@cnConstFLabelFontHeightF = 0.0 res@sfXArray = lon ; Associates lat/lon locations res@sfYArray = lat ; with data values. ;---Customize the map outlines. ;res@mpDataBaseVersion = ;"MediumRes" res@pmTickMarkDisplayMode = "Always" ; make contour contour_pre = gsn_csm_contour(wks,radar,res) ; overlap overlay(map,contour_pre) draw(map) frame(wks) end do end