See Example 3 at
http://www.ncl.ucar.edu/Applications/cylineq.shtml
Erik Noble wrote:
> Dear NCL,
> Could I have some help with using the gsn_csm_contour_map_ce command? I 
> plotted precipitation data from TRMM using the gsn_csm_contour_map_ce. 
> It worked for plotting a global plot.(1st image). I tried to plot a 
> sub-region of the data using the gsnAddCyclic = False 
> AND 
> mpCorner commands. A plot was plottted but the image is so small 
> compared to the rest of the map. (2nd image). How can I just plot the 
> subregion by itself?
> Thank you.
> Sincerely,
> erik
> 
> Terminal history:
> 
> noble:TRMM3B42 enoble$ ncl extract_TRMM_regrid_plot-SOP3.ncl 
>  Copyright (C) 1995-2009 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 5.1.0
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
> (0)     
> (0)    min=0   max=245.562
> 
> 
> Variable: rain
> Type: float
> Total Size: 552960000 bytes
>             138240000 values
> Number of Dimensions: 3
> Dimensions and sizes:    [Time | 240] x [Lat | 400] x [Lon | 1440]
> Coordinates: 
> Number Of Attributes: 3
>   Lon :    <ARRAY of 1440 elements>
>   Lat :    <ARRAY of 400 elements>
>   _FillValue :    -999
> 
> 
> Variable: rNEW
> Type: float
> Total Size: 138240000 bytes
>             34560000 values
> Number of Dimensions: 3
> Dimensions and sizes:    [Time | 240] x [lat | 200] x [lon | 720]
> Coordinates: 
>             Time: [1..240]
>             lat: [-49.875..49.625]
>             lon: [-179.875..179.625]
> Number Of Attributes: 1
>   _FillValue :    -999
> (0)     
> (0)    min=0   max=224.236
> (0)     
> (0)    min=0   max=1090.89
> noble:TRMM3B42 enoble$ 
> 
> 
> 
> SCRIPT:  Plotting parts are near the end....
> 
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> setfileoption("bin","ReadByteOrder","BigEndian")
> nlat = 400;default latitudes in file 0.25 by 0.25 degree
> nlon = 1440     ;default longitutdes in file 0.25 by 0.25 degree
> fils = systemfunc("ls *precipitation.bin")
> nfils = dimsizes(fils)
> prate = new((/nfils,nlat,nlon/),"float")      ; New array for rain rate 
>                
> p = new((/nfils,nlat,nlon/),"float")             ; New array for rain 
> do gg = 0,dimsizes(fils)-1           ; Do loop to extract variable form 
> binary files                         
> prate(gg,:,:) = fbindirread(fils(gg),0,(/nlat,nlon/),"float") 
> p(gg,:,:) = prate(gg,:,:) * 3 ; rain per three hours (mm) 
> end do                                                        
> 
> rain     = where(p.lt.0.01 , 0.0, p)   ; keep precipitation values above 
> zero                 
> printMinMax(rain, True)
> 
> rain!0="Time" 
> 
> ;;;;;;;;;;;;;;;;;;;;Coordinates........What is neccessary to plot a map 
> plot?????  
> rain!1="Lat"
> Lat        = ispan(0,nlat-1,1)*0.25 -  49.875   ; From TRMM README file
> Lat_at_units = "degrees_north"
> rain_at_Lat =Lat
> 
> rain!2="Lon"
> Lon        = ispan(0,nlon-1,1)*0.25 - 179.875 ; From TRMM README file
> Lon_at_units  = "degrees_east"
> rain_at_Lon =Lon
> 
> lat2d  = rain(0,:,:)
> lon2d = rain(0,:,:)
> lat2d_at_units = "degrees_north"   
> lon2d_at_units = "degrees_east" 
> 
> printVarSummary(rain)
> 
> ;;;;For regridding function;;;;
> ylat = Lat
> xlon = Lon
> ylat!0 = "Lat"
> xlon!0 = "Lon"
> lat2d = new((/400,1440/),float)
> lon2d = new((/400,1440/),float)
> lat2d!0 =  "Lat"
> lat2d!1 =  "Lon"
> lon2d!0 =  "Lat"
> lon2d!1 =  "Lon"
> lat2d_at_units = "degrees_north"   
> lon2d_at_units = "degrees_east" 
> ; Just copy the 2d grid coordinates to match the rain array and keep 
> number of elements consistent.
> do i=0,399
> lon2d(i,:) = xlon(:)
>  end do
> do i=0,1439
> lat2d(:,i) = ylat(:)
> end do
> ;;; Now, we want to regrid the TRMM data to a 0.5 by 0.5 grid. This 
> means that it we have to divide by half.
> NLAT = 200
> NLAT = 200; 400/2
> MLON = 720
> MLON = 720; 1440/2
> lat = ispan(0,NLAT-1,1)*0.50 - 49.875
> lon = ispan(0,MLON-1,1)*0.50 - 179.875
> lat!0         = "lat"
> lat_at_units     = "degrees_north"
> lat&lat       = lat
> lon!0         = "lon"
> lon_at_units     = "degrees_east"
> lon&lon       = lon
> rNEW = new 
> ((/dimsizes(fils),NLAT,MLON/),typeof(rain),getFillValue(rain))  ;New 
> rain array
> rNEW!0 = "Time"                                                           
> rNEW&Time = ispan(1,dimsizes(fils),1)                                     
> rNEW!1 = "lat"
> rNEW&lat = lat
> rNEW!2 = "lon"
> rNEW&lon = lon
> ;;;;;;;;;;;;;;TRIPLE2GRID;;;;;;;;;;;;;;;
> do ii = 0,dimsizes(fils)-1
>     rNEW(ii,:,:) = triple2grid(ndtooned(lon2d), ndtooned(lat2d), 
> ndtooned( rain(ii,:,:)),lon,lat,False) 
> end do
>  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> printVarSummary(rNEW)
> printMinMax(rNEW,True)
> total_rain = dim_sum_Wrap(rNEW(lat|:, lon|:, Time|:) )    
> printMinMax(total_rain,True)
> 
> ; The next set of commands set up plot properties
> wks = gsn_open_wks("ps","Test_TRMM")
> colors = (/"white","black"          \        ; {for/back}ground 
>             ,"white","azure"          \                         
>              ,"green","palegreen","yellowgreen", "greenyellow" \ 
>              ,"yellow","goldenrod","orange","orangered"        \ 
>              
>  ,"red","deeppinK","violet","darkviolet","blueviolet","blue"/)           
>           
> gsn_define_colormap(wks, colors)
> res                       = True             ; plot mods desired
> ; res_at_gsnMaximize           = True             ; uncomment to maximize size
> res_at_gsnSpreadColors       = True             ; use full range of colormap
> res_at_cnFillOn              = True ;False             ; color plot desired
> res_at_cnLinesOn             = False            ; turn off contour lines
> res_at_cnLineLabelsOn        = False            ; turn off contour labels
>   
> res_at_cnLevelSelectionMode  = "ExplicitLevels" ; explicit [unequal] cn levels
> res_at_cnLevels              = 
> (/0,50,100,150,200,250,300,350,400,450,500,550,600,650,700,750,800/)
> res_at_cnFillMode            = "AreaFill" ;"RasterFill"
> res_at_lbOrientation         = "Vertical"       ; default is horizontal
> 
> ; Plot the plots
> x = gsn_csm_contour_map_ce(wks,total_rain,res)
> total_TRMM_R1=total_rain({5.0:11.5},{-30.875:-20.875})
> 
> res_at_gsnAddCyclic = False
> ;Plot Region 1, from rn_R1(it,:,:)=rainw(8,55:67,10:30)-rainw(0,55:67,10:30)
>  res_at_mpLeftCornerLatF    = lat2d(55,10)
>  res_at_mpLeftCornerLonF    = lon2d(55,10)
>  res_at_mpRightCornerLatF   = lat2d(67,30)
>  res_at_mpRightCornerLonF   = lon2d(67,30)
>  res_at_gsnLeftString = "Region 1: Atlantic ITCZ"
> x2 = gsn_csm_contour_map_ce(wks,total_TRMM_R1,res)
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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 Wed May 20 2009 - 01:26:33 MDT
This archive was generated by hypermail 2.2.0 : Thu May 21 2009 - 16:54:57 MDT