[ncl-talk] To add dots over desired location in a map
Karin Meier-Fleischer
meier-fleischer at dkrz.de
Fri Jul 10 08:27:09 MDT 2015
Hi Tabish,
please send the replies always to ncl-talk.
I took a look at your script and my question is do you really know what the parts are doing especially the
resources? The part of the polymarkers you mentioned in your first email aren’t included but different resources
been set without any use.
Here is the cleaned but untested script which includes the missing resource settings and where the
needless resources were deleted.
;+++++++++++++++++++++++++++++++++++++++++++++++
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
; The WRF ARW input file.
; This needs to have a ".nc" appended, so just do it.
a = addfile("/home/admin/IBM-Research_intern/Emissions_data/Anthro/SEAC4RS_North_Hemisphere.nc","r")
emiss = a->co ;emissions;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
x_start = 167
x_end = 175
y_start = 282
y_end = 289
emiss_zoom = emiss(y_start:y_end,x_start:x_end)
emiss_zoom = emiss_zoom * 1000 ; converting into Tonnes per 10km^2 per yr
;-- open a workstation
type = "x11"
wks = gsn_open_wks(type,"CO_SEAC4RS_Delhi") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
; Set some Basic Plot options
res = True
res at cnFillOn = True
res at gsnSpreadColors = True
res at cnLevelSelectionMode = "ManualLevels"
res at cnMinLevelValF = 0
res at cnMaxLevelValF = 30000
res at cnLevelSpacingF = 300
res at cnLinesOn = False ;turning off contour lines and labels
res at cnFillMode = "RasterFill"
res at gsnDraw = False
res at gsnFrame = False
;-- contour plot
plot = gsn_csm_contour(wks,emiss_zoom,res)
;-- shapefile
india_shp_name = "/home/admin/IBM-Research_intern/Shapefiles/India/IND_adm3.shp"
lnres = True
lnres at gsLineColor = "black"
lnres at gsLineThicknessF = 1.5
india_id = gsn_add_shapefile_polylines(wks,plot,india_shp_name,lnres)
;-- polymarker
pmres = True
pmres at gsMarkerColor = "Black"
pmres at gsMarkerIndex = 16
pmres at gsMarkerSizeF = 0.01
polym_id = gsn_add_polymarker(wks, plot,28.45, 77.00,pmres)
;-- create the plot
draw(plot) ; This will draw the map and the shapefile outlines.
frame(wks) ; Advance the frame
end
;+++++++++++++++++++++++++++++++++++++++++++++++
Bye,
Karin
> Am 10.07.2015 um 14:09 schrieb Tabish Ansari <tabishumaransari at gmail.com>:
>
> Hi Karin
>
> Thanks for your reply. I have done as you said, but it's still not working. Below is my entire script:
>
> ; Example script to produce plots for a WRF real-data run,
> ; with the ARW coordinate dynamics option.
> ; The script shows how to zoom into a given area
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>
> begin
> ; The WRF ARW input file.
> ; This needs to have a ".nc" appended, so just do it.
> a = addfile("/home/admin/IBM-Research_intern/Emissions_data/Anthro/SEAC4RS_North_Hemisphere.nc","r")
>
> ; We generate plots, but what kind do we prefer?
> type = "x11"
> wks = gsn_open_wks(type,"CO_SEAC4RS_Delhi");;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
> ;gsn_define_colormap(wks,"hotres")
> ; Set some Basic Plot options
> res = True
> ;res at MainTitle = "REAL-TIME WRF"
>
> pltres = True
> mpres = True
> mpres1 = True
> res = True
> res at cnFillOn = True
> res at gsnSpreadColors = True
> res at cnLevelSelectionMode = "ManualLevels"
> res at cnMinLevelValF = 0
> res at cnMaxLevelValF = 30000
> res at cnLevelSpacingF = 300
> res at cnLinesOn = False ;turning off contour lines and labels
> res at cnFillMode = "RasterFill"
> res at gsnDraw=False
> res at gsnFrame=False
> emiss = a->co ;emissions;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> x_start = 167
> x_end = 175
> y_start = 282
> y_end = 289
>
> mpres1 at ZoomIn = True
> mpres1 at Xstart = x_start
> mpres1 at Ystart = y_start
> mpres1 at Xend = x_end
> mpres1 at Yend = y_end
>
> emiss_zoom = emiss(y_start:y_end,x_start:x_end)
> emiss_zoom = emiss_zoom * 1000 ; converting into Tonnes per 10km^2 per yr
> ;emiss_zoom at description = emiss at description + " - Zoom over India"
> opts = res
> opts at cnFillOn = True
> plot = gsn_csm_contour(wks,emiss_zoom,res)
> delete(opts)
> india_shp_name = "/home/admin/IBM-Research_intern/Shapefiles/India/IND_adm3.shp"
> ;lanka_shp_name = "/media/ResearchWork/Shapefiles/Sri-Lanka/LKA_adm0.shp"
> lnres = True
> lnres at gsLineColor = "black"
> lnres at gsLineThicknessF = 1.5
> india_id = gsn_add_shapefile_polylines(wks,plot,india_shp_name,lnres)
> ;lanka_id = gsn_add_shapefile_polylines(wks,plot,lanka_shp_name,lnres)
>
> str = unique_string("mark")
> plot@$str$ = gsn_add_polymarker(wks, plot,28.45, 77.00,pmres)
>
> draw(plot) ; This will draw the map and the shapefile outlines.
> frame(wks) ; Advance the frame
>
>
> end
>
>
>
> Thanks
>
> Tabish
>
> Tabish U Ansari
> IBM Research India Laboratory
> New Delhi
>
> On 10 July 2015 at 17:33, Karin Meier-Fleischer <meier-fleischer at dkrz.de <mailto:meier-fleischer at dkrz.de>> wrote:
> Hi Tabish,
>
> if you created a map plot than you can use the function gsn_add_polymarker to draw marker
> at specific lat/lon positions:
>
> str = unique_string("mark")
> plot@$str$ = gsn_add_polymarker(wks, plot, 77.00, 28.45., pmres)
>
> Each polymarker has to have its own id so it is a good idea to use the unique_string function to generate a unique id name.
>
> Bye,
> Karin
>
> Am 10.07.15 um 13:55 schrieb Tabish Ansari:
>> Hi
>>
>> I wish to add dots to demarcate specific locations of my interest in my map. I know the lat-lon of those locations. I am including the following lines in my script:
>>
>> pmres = True
>> pmres at gsMarkerColor = "Black"
>> pmres at gsMarkerIndex = 16
>> pmres at gsMarkerSizeF = 0.01
>> gsn_polymarker(wks,plot,77.00,28.45,pmres)
>> draw(plot) ; This will draw the map and the shapefile outlines.
>> frame(wks) ; Advance the frame
>>
>> However, no dot is visible in the map. Also I am not getting any errors or warning.
>>
>> Please help me out with this
>>
>> Thanks in advance!
>>
>> Tabish
>>
>> Tabish U Ansari
>> IBM Research India Laboratory
>> New Delhi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150710/866de472/attachment.html
More information about the ncl-talk
mailing list