Re: contour plot from ASCII data

From: <debasish_at_nyahnyahspammersnyahnyah>
Date: Sun Dec 18 2011 - 22:29:30 MST

Hi,

You need to define latitude and longitude before the plot

lat = fspan(-10,10,9)
lon = fspan(80,160,33)

data!0="lon"
data!1="lat"
data&lat=lat
data&lon=lon

data&lat@units="degrees_north"
data&lon@units="degrees_east"

Good luck

Debasish

> Hi All,
>
> This is my first time to use NCL for plotting my research data. Thus, I
>  have not yet had any experience to do it. Hope your sharing for that.
>
> I want to make a contour plot from the attached file (ASCII file). I use
> the following code:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> begin
> ; read in data                                  
>    ncols    = 9  ; -10:2.5:10 Latitude
>                     
>    nrows   = 33 ; 80:2.5:160E Longitude
>    
>    data      = asciiread ("djfOLR.txt", (/nrows,ncols/), "float")
>
>
>  
>   wks = gsn_open_wks("ps" ,"ce")                ; open a ps file
>   gsn_define_colormap(wks,"BlAqGrYeOrRe")        ; choose colormap
>
>   res                       = True     ; plot mods desired
>
>   res@cnFillOn              = True     ; turn on color fill
>   res@cnLinesOn             = False    ; turn of contour lines
>   res@cnLevelSpacingF       = 0.5      ; contour spacing
>   res@gsnSpreadColors       = True     ; use full range of color map
>   res@lbLabelStride         = 4
>
>   res@pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels
>
>   res@gsnAddCyclic          = False    ; data already has cyclic point
>       ; this must also be set for any zoom
>
> ; note that the gsn_csm_*map_ce templates automatically set 
> ; res@mpLimitMode="LatLon" for you. If you are plotting a different
> projection,
> ; you may have to set this resource.
>
>   res@mpMinLatF            = -10      ; range to zoom in on
>   res@mpMaxLatF            =  10.
>   res@mpMinLonF            =  80.
>   res@mpMaxLonF            = 160.
>
>   plot = gsn_csm_contour_map_ce(wks,data, res)
> ;************************************************
> end
>
> I have the result, but only the plot of Indonesian map without my data.
> Hope your sharing for this problem..
>
>
> Regards,
> JuKY_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Dec 18 22:30:28 2011

This archive was generated by hypermail 2.1.8 : Wed Dec 21 2011 - 10:44:06 MST