[ncl-talk] how to specify the orientation of the plot to portrait
Mary Haley
haley at ucar.edu
Tue Aug 5 13:48:15 MDT 2014
Can you please try wrf_map_overlays instead of wrf_map_overlay?
wrf_map_overlay is a deprecated function.
Please see the wrf_map_overlays documentation for more information:
http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_map_overlays.shtml
Also, there are some cases where the WRF functions don't recognize the
gsnXXXX resources, and so it's possible that gsnPaperOrientation is getting
ignored.
You can try not setting gsnMaximize to True to see if that turns off the
rotation of your plot.
If you continue to have problems, it would help if you could provide the
data file needed to run your script.
Thanks,
--Mary
On Mon, Aug 4, 2014 at 9:43 PM, 杨玉华 <yangyh at mail.typhoon.gov.cn> wrote:
> Hi,
>
> I'd like to specify the orientation of the plot to portrait, but I'm
> failed even I using the following scripts:
>
> opts_r at gsnMaximize = True
> opts_r at gsnPaperOrientation = "portrait"
>
> or
>
> type at wkOrientation = "portrait"
>
> Attachment is my scripts, please check it.
>
> Thanks in advance.
>
> Yuhua
>
>
> *您于 Tue, 5 Aug 2014 11:12:04 +0800 的来信中写到: *
>
> Dear Sir
>
> i am trying to read TRMM(tropical rainfall measuring mission data) on NCL
> version 6.1.2 but as the latitude and longitude are different from
> geographic values i.e from ncl_filedump i get total longitude = 1440
> latitude = 400, the spatial resolution is 25km .
> i need to extract rainfall data at a location lat=1.3911 and long
> =103.9864 for that i used the formula
> trmmlat=
> ((lat+49.875)/0.25)+1
>
> trmmlong=
> ((long+179.875)/0.25)+1
>
> and then extract the pcp variables using ncl at these trmmlat and trmmlong
> ,i want to make sure whether my method is correct or not.
>
> regards
> saurabh
>
>
>
> On Tue, Aug 5, 2014 at 2:00 AM, <ncl-talk-request at ucar.edu> wrote:
>
>> Send ncl-talk mailing list submissions to
>> ncl-talk at ucar.edu
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> or, via email, send a message with subject or body 'help' to
>> ncl-talk-request at ucar.edu
>>
>> You can reach the person managing the list at
>> ncl-talk-owner at ucar.edu
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of ncl-talk digest..."
>>
>>
>> Today's Topics:
>>
>> 1. Re: triple2grid (Dennis Shea)
>> 2. Re: How to create two y axis with a common x axis in bar plot
>> (Mary Haley)
>> 3. Re: (no subject) (Dennis Shea)
>> 4. Re: Running example scripts for beginners (Mary Haley)
>> 5. Re: read separated files (Dennis Shea)
>> 6. Using a loop to find values greater than 0 (calculate PDD)
>> (Lauren Jean Vargo)
>> 7. Re: Using a loop to find values greater than 0 (calculate
>> PDD) (Dennis Shea)
>> 8. Re: Using a loop to find values greater than 0 (calculate
>> PDD) (Kyle Griffin)
>> 9. Re: Strange white lines across plot (Mary Haley)
>> 10. Re: Fwd: Masking a U.S. county from a netcdf file (Mary Haley)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Mon, 4 Aug 2014 07:17:29 -0600
>> From: Dennis Shea <shea at ucar.edu>
>> Subject: Re: [ncl-talk] triple2grid
>> To: Manisha Ganeshan <manisha.ganeshan86 at gmail.com>
>> Cc: NCL-talk <ncl-talk at ucar.edu>
>> Message-ID:
>> <CAOF1d_4pLjOOnFbXb-7ju2BQbkXwbx=iCVsuVWjiUM=
>> wyR_Efw at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Not that I am aware of. Sorry.
>>
>>
>> On Fri, Aug 1, 2014 at 4:10 PM, Manisha Ganeshan <
>> manisha.ganeshan86 at gmail.com> wrote:
>>
>> > Thanks, Dennis. Is there a function that calculates the mean or saves
>> the
>> > total number of nearest neighbor source points for each grid point in
>> the
>> > destination grid?
>> >
>> > Regards,
>> > Nisha
>> >
>> >
>> > On Fri, Aug 1, 2014 at 6:03 PM, Dennis Shea <shea at ucar.edu> wrote:
>> >
>> >> It does not calculate the mean. New 'nearest neighbor' values overwrite
>> >> previous values.
>> >>
>> >>
>> >> On Fri, Aug 1, 2014 at 3:59 PM, Manisha Ganeshan <
>> >> manisha.ganeshan86 at gmail.com> wrote:
>> >>
>> >>> Hello,
>> >>>
>> >>> I have a question about the *triple2grid* function. The description
>> >>> says that the function does not perform interpolation but instead
>> assigns
>> >>> each unstructured (source) data point to the nearest grid point
>> >>> (destination). How does it treat multiple unstructured data points
>> (source)
>> >>> that have a common nearest grid point (destination)? Does it
>> calculate the
>> >>> mean value (after ignoring missing values)?
>> >>>
>> >>> Thanks,
>> >>> Nisha
>> >>>
>> >>> _______________________________________________
>> >>> ncl-talk mailing list
>> >>> List instructions, subscriber options, unsubscribe:
>> >>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >>>
>> >>>
>> >>
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140804/81cbd948/attachment-0001.html
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Mon, 4 Aug 2014 08:29:44 -0600
>> From: Mary Haley <haley at ucar.edu>
>> Subject: Re: [ncl-talk] How to create two y axis with a common x axis
>> in bar plot
>> To: Ipshita Majhi <ipmajhi at alaska.edu>
>> Cc: NCL USERS <ncl-talk at ucar.edu>
>> Message-ID:
>> <CACNN_CKd2OjK7wbauhLmC01QPRpsCMfMq2aYC1CDzqh=
>> UQeVog at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Ipsita,
>>
>> In order to overlay a bunch of bar charts, it works best if you can shift
>> each of the bars by a certain bar width, and then you can draw them
>> side-by-side. I think you may have used part of bar_11.ncl on our bar
>> examples page, and this is a good one to work with. However, you want to
>> add some overlay code in there, which will make all the plots part of the
>> same plot.
>>
>> The key is to draw each set of bars with a slightly shifted set of X
>> values, so the bars are drawn next to each other.
>>
>> See the attached example and script.
>>
>> --Mary
>>
>>
>>
>> On Fri, Aug 1, 2014 at 4:27 PM, Ipshita Majhi <ipmajhi at alaska.edu> wrote:
>>
>> > Hi,
>> > I want to plot trend values and monthly means in one plot. Both are an
>> > array of size 12 .
>> > The program gives no error but the plot are overlapping. I am not sure
>> how
>> > to fix it. I realized that if I use the below mentioned method they
>> overlap
>> > is there a way to have two y axis in bar plots. Since the trends are
>> much
>> > smaller then avgs.
>> >
>> > ;*****************************************************
>> > ;Trend and monthly climatology together in one bar plot
>> > ;*******************************************************
>> >
>> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> >
>> > months=(/1,2,3,4,5,6,7,8,9,10,11,12/)
>> >
>> >
>> >
>> monthly_avg=asciiread("~/Documents/PhD_June_2015/NCL_Moonsoon/Data_output/Monthly_avg_air.txt",-1,
>> > "float")
>> >
>> >
>> monthly_Trend=asciiread("~/Documents/PhD_June_2015/NCL_Moonsoon/Data_output/trend_air.txt",
>> > -1, "float")
>> > printVarSummary(monthly_avg)
>> >
>> > wks = gsn_open_wks("ps","Trend_Avg")
>> >
>> >
>> > sres = True
>> > sres at vpWidthF = 0.7
>> > sres at vpHeightF = 0.5
>> > sres at gsnDraw = True
>> > sres at gsnFrame = False
>> > sres at gsnXYBarChart = True
>> > sres at gsnXYBarChartBarWidth = 0.15 ; change bar widths
>> > sres at tmXBMode = "Explicit" ; explicit labels
>> > sres at tmXBValues = (/1,2,3,4,5,6,7,8,9,10,11,12/)
>> > sres at tmXBLabels =
>> >
>> (/"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"/)
>> > sres at tmXBLabelFontHeightF = 0.0205
>> > sres at tmXTLabelFontHeightF = 0.0205
>> > sres at tmYLLabelFontHeightF = 0.0225
>> > sres at tiMainFontHeightF = 0.025
>> > sres at tiMainFont = "helvetica"
>> > sres at tiMainString = "All India Rainfall Climatology and Trend
>> > 1880-2012"
>> > sres at tiYAxisString = "(mm)"
>> >
>> > plot1 = gsn_csm_xy (wks,months,monthly_avg,sres)
>> > sres at gsnXYBarChartColors = (/"red"/) ;
>> > seperately, not
>> > plot2 = gsn_csm_xy(wks,months,monthly_Trend,sres)
>> > ; advancing the frame
>> > sres at gsnXYBarChartColors = (/"blue"/) ; but
>> > tweaking where
>> >
>> >
>> > _______________________________________________
>> > ncl-talk mailing list
>> > List instructions, subscriber options, unsubscribe:
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140804/b04f1178/attachment-0001.html
>> -------------- next part --------------
>> A non-text attachment was scrubbed...
>> Name: bar.png
>> Type: image/png
>> Size: 42598 bytes
>> Desc: not available
>> Url :
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140804/b04f1178/attachment-0001.png
>> -------------- next part --------------
>> A non-text attachment was scrubbed...
>> Name: bar_11.ncl
>> Type: application/octet-stream
>> Size: 3061 bytes
>> Desc: not available
>> Url :
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140804/b04f1178/attachment-0001.obj
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Mon, 4 Aug 2014 08:44:26 -0600
>> From: Dennis Shea <shea at ucar.edu>
>> Subject: Re: [ncl-talk] (no subject)
>> To: Modise Wiston <modise.wiston at postgrad.manchester.ac.uk>
>> Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>> Message-ID:
>> <
>> CAOF1d_4GEj90MZ04-u1vemt3UbnH+vd--oWt1Ax73BAP2poQag at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> While not WRF, the last example at:
>> http://www.ncl.ucar.edu/Applications/iso.shtml
>>
>> may give you an idea of how to approach the issue.
>>
>> ===
>> Also, please send *all* WRF questions to wrfhelp at ucar.edu
>> The know the WRF model best.
>> You can cc ncl-talk at ucar but, really, wrfhelp should be your primary
>> contact for assorted WRF related issues.
>>
>> Good luck
>>
>>
>>
>> On Sat, Aug 2, 2014 at 12:06 PM, Modise Wiston <
>> modise.wiston at postgrad.manchester.ac.uk> wrote:
>>
>> > *To whom it may concern*
>> >
>> > *Hi all,*
>> >
>> > *I am trying to determine the cloud droplet number
>> > concentration (QNDROP) from my [WRF-Chem] model simulation. The script
>> [see
>> > the code below] is such that the code loops through the x-y-z (i-j-k)
>> > planes and finds the max (& min) QNDROP along the vertical (model
>> levels).
>> > The code is such that it exits/stops just after the first cloud band
>> only
>> > -without continuing through all the layers above the first cloud band.
>> This
>> > also calculates CCN number concentrations below the cloud base.*
>> >
>> > *How can I make it (or write a function/code) to calculate the height
>> at
>> > which the max QNDROP occurs..? I have been trying to go through several
>> NCL
>> > examples (functions) but couldn't figure out out how to do this.. (I
>> would
>> > like to plot 'height vs max QNDROP' on the horizontal lat-lon domain) *
>> >
>> > *Any help is appreciated please..*
>> > *Thank you,*
>> > *M. Wiston*
>> > *The University of Manchester *
>> >
>> >
>> -----------------------------------------------------------------------------------------------------------
>> > dt = 6
>> > do ifil = 0, 0; numFILES-48, dt
>> > a = addfile(FILES(ifil)+".nc","r")
>> > ;list time step to output data
>> > times = wrf_user_list_times(a)
>> > ntimes = dimsizes(times)
>> >
>> > do it = 0,ntimes-1,2
>> > do ispec = 0, nspec-1
>> > species = speclist(ispec)
>> >
>> > ;Obtain the variables from the file
>> > if(isfilevar(a,"QNDROP"))
>> > N = wrf_user_getvar(a,"QNDROP",it)
>> > Nd = (N*1.2923)/1e6 ; convert from /kg to /sm^3
>> then
>> > to /scm^3
>> > Nd at units = "/cm^3" ; converted units
>> > end if
>> >
>> > ;define an array to hold data
>> > dimsNd = dimsizes(Nd)
>> > print(dimsNd)
>> >
>> > ;----------------Determine the domain size (grid points and
>> > vert. levels)----------------;
>> > ; (321 x 251) ; grid points along "i"
>> > (hor) by "j" (vert) direction ;
>> > ; (e_we:lat, e_sn:lon)
>> > ;
>> > ; 40 vert levels:(k) ; model levels
>> > ;
>> > ; Print output gives: k = 40 ;NB: this is read starting
>> from
>> > zero (i.e. 0-39) ;
>> > ; j = 250
>> > ;
>> > ; i = 320
>> > ;
>> >
>> >
>> ;------------------------------------------------------------------------------------------------;
>> > min_Nd = new( (/dimsNd(1),dimsNd(2)/),float )
>> > max_Nd = new( (/dimsNd(1),dimsNd(2)/),float )
>> > c_btm = new( (/dimsNd(1),dimsNd(2)/),integer )
>> > c_top = new( (/dimsNd(1),dimsNd(2)/),integer )
>> >
>> > do j = 0, dimsNd(1)-1 ; loop along j
>> > do i = 0, dimsNd(2)-1 ; loop along i
>> > ; cldfrc = (i*j)
>> > c_btm(j,i) = -1 ;define cloud base and
>> > cloud top limits to confine the execution
>> > c_top(j,i) = -1
>> > do k = 0, dimsNd(0)-2 ; loop [vertically] through
>> > levels
>> > ; print("k= "+k)
>> > if(Nd(k,j,i) .le. cut_pnt .and. Nd((k+1),j,i) .gt. cut_pnt)
>> > c_btm(j,i) = (k+1)
>> > ;[cloud base]
>> > ; print("c_btm = "+c_btm(j,i))
>> >
>> > else if (Nd(k,j,i) .gt. cut_pnt .and. Nd((k+1),j,i) .le. cut_pnt) then
>> > c_top(j,i) = k
>> > ;[cloud top]
>> > break ; exit the the process after the first
>> > cloud band
>> > end if
>> > end if
>> > end do
>> > ; min_Nd(i) = min(Nd(:,i))
>> > ; max_Nd(i) = max(Nd(:,i))
>> > ; min_Nd(j) = min(Nd(:,j))
>> > ; max_Nd(j) = max(Nd(:,j))
>> > ; min_Nd(j,i) = min(Nd(:,j,i))
>> > ; max_Nd(j,i) = max(Nd(0:3,j,i))
>> >
>> > if(c_btm(j,i) .eq. -1 .and. c_top(j,i) .eq. -1)
>> > max_Nd(j,i) = 0.0
>> >
>> > else if (c_btm(j,i) .gt. -1 .and. c_top(j,i) .gt. -1) then
>> > max_Nd(j,i) = max( Nd(c_btm(j,i):c_top(j,i),j,i) )
>> > ;print(min_Nd(j,i))
>> > ;print("max_Nd = " +max_Nd(j,i))
>> > print("| "+sprintf("%5.3f",max_Nd(j,i))+ " | "+sprintf("%2.1f",
>> > c_btm(j,i))+" | "+sprintf("%2.1f", c_btm(j,i))+" |" )
>> > end if
>> > end if
>> > end do
>> > end do
>> >
>> >
>> ;------------------------------------------------------------------------------------------
>> >
>> > ;;get the CCN number concentration from the file
>> > Cn1 = wrf_user_getvar(a,"CCN1",it)
>> > Cn2 = wrf_user_getvar(a,"CCN2",it)
>> > Cn3 = wrf_user_getvar(a,"CCN3",it)
>> > Cn4 = wrf_user_getvar(a,"CCN4",it)
>> > Cn5 = wrf_user_getvar(a,"CCN5",it)
>> > Cn6 = wrf_user_getvar(a,"CCN6",it)
>> > z = wrf_user_getvar(a,"z",it)
>> > w = wrf_user_getvar(a,"wa",it) ; vertical
>> > [updraft..??] velocity
>> > w at units = "m/s"
>> >
>> > p = wrf_user_getvar(a, "p",it) ;extract p and tk to
>> > convert to STP
>> > tk = wrf_user_getvar(a,"tk",it)
>> > C1 = Cn1*((tk/p)*(P_std/T_std))
>> > C2 = Cn2*((tk/p)*(P_std/T_std))
>> > C3 = Cn3*((tk/p)*(P_std/T_std))
>> > C4 = Cn4*((tk/p)*(P_std/T_std))
>> > C5 = Cn5*((tk/p)*(P_std/T_std))
>> > C6 = Cn6*((tk/p)*(P_std/T_std))
>> > C1 at units = "/cm^3"
>> >
>> > C1_btm = new( (/dimsNd(1),dimsNd(2)/),float )
>> > C2_btm = new( (/dimsNd(1),dimsNd(2)/),float )
>> > C3_btm = new( (/dimsNd(1),dimsNd(2)/),float )
>> > C4_btm = new( (/dimsNd(1),dimsNd(2)/),float )
>> > C5_btm = new( (/dimsNd(1),dimsNd(2)/),float )
>> > C6_btm = new( (/dimsNd(1),dimsNd(2)/),float )
>> > SS = new( (/dimsNd(1),dimsNd(2)/),float )
>> >
>> > do j = 0, dimsNd(1)-1
>> > do i = 0, dimsNd(2)-1
>> > if(c_btm(j,i) .eq. -1)
>> > C1_btm(j,i) = 0.0
>> > C2_btm(j,i) = 0.0
>> > C3_btm(j,i) = 0.0
>> > C4_btm(j,i) = 0.0
>> > C5_btm(j,i) = 0.0
>> > C6_btm(j,i) = 0.0
>> >
>> > else if(c_btm(j,i) .ne. -1) then
>> > C1_btm(j,i) = ( C1(c_btm(j,i),j,i) )
>> > C2_btm(j,i) = ( C2(c_btm(j,i),j,i) )
>> > C3_btm(j,i) = ( C3(c_btm(j,i),j,i) )
>> > C4_btm(j,i) = ( C4(c_btm(j,i),j,i) )
>> > C5_btm(j,i) = ( C5(c_btm(j,i),j,i) )
>> > C6_btm(j,i) = ( C6(c_btm(j,i),j,i) )
>> >
>> > ; print("Cn1 = " +C1_btm(j,i))
>> > ; print("Cn2 = " +C2_btm(j,i))
>> > ; print("Cn3 = " +C3_btm(j,i))
>> > ; print("Cn4 = " +C4_btm(j,i))
>> > ; print("Cn5 = " +C5_btm(j,i))
>> > ; print("Cn6 = " +C6_btm(j,i))
>> > print("| "+sprintf("%4.3f", C1_btm(j,i))+" | "+sprintf("%4.3f",
>> > C2_btm(j,i))+" | "+sprintf("%4.3f", C3_btm(j,i))+" | "+\
>> > sprintf("%4.3f", C4_btm(j,i))+" | "+sprintf("%4.3f", C5_btm(j,i))+" |
>> > "+sprintf("%4.3f", C6_btm(j,i))+" |" )
>> > end if
>> > end if
>> > end do
>> > end do
>> >
>> >
>> ;`````````````````````````````````````````````````````````````````````````````````
>> >
>> > ; if(max_Nd(j,i) .le. C1_btm(j,i))
>> > ; SS(j,i) = 0.01
>> >
>> > ; else if(max_Nd(j,i) .gt. C1_btm(j,i) .and.
>> > max_Nd(j,i) .le. C2_btm(j,i))
>> > ; SS(j,i) = "0.02%"
>> >
>> > ; else if(max_Nd(j,i) .gt. C2_btm(j,i) .and.
>> > max_Nd(j,i) .le. C3_btm(j,i))
>> > ; SS(j,i) = "0.1%"
>> >
>> > ; else if (max_Nd(j,i) .gt. C3_btm(j,i) .and.
>> > max_Nd(j,i) .le. C4_btm(j,i))
>> > ; SS(j,i) = "0.2%"
>> >
>> > ; else if (max_Nd(j,i) .gt. C4_btm(j,i) .and.
>> > max_Nd(j,i) .le. C5_btm(j,i))
>> > ; SS(j,i) = "0.5%"
>> >
>> > ; else if (max_Nd(j,i) .gt. C5_btm(j,i) .and.
>> > max_Nd(j,i) .le. C6_btm(j,i))
>> > ; SS(j,i) = "1.0%"
>> > ; end if
>> > ; end if
>> > ; end if
>> > ; end if
>> > ; end if
>> > ; end if
>> >
>> >
>> ;-------------------------------------------------------------------------------------------
>> > ;Set some Basic Plot options
>> > res = True
>> > res at tiMainString = "CCN nmbr @: " +times(it) ; main
>> > field title
>> > mpres = True
>> > pltres = True
>> >
>> > res at gsnMaximize = False
>> > res at gsnFrame = False
>> > res at gsnDraw = False
>> > res at cnFillOn = True
>> > res at cnLinesOn = False ; turn off contour
>> > lines
>> > res at cnLineLabelsOn = False ; lables the data
>> > on contours/map grids
>> > res at gsnSpreadColors = True
>> > res at lbOrientation = "Horizontal" ;
>> > orientates the linear scale
>> > res at cnLevelSelectionMode = "ExplicitLevels"
>> >
>> >
>> ;-------------------------------------------------------------------------------------------
>> > res at tiYAxisString = ""
>> > res at tiXAxisString = "Nmbr cont'n (/cm^3)"
>> > res at tiXAxisSide = "Bottom"
>> >
>> > ;res at tiMainString = "Droplet nmbr at: " +times(it)
>> > contour_Nd = wrf_contour(a,wks,max_Nd,res)
>> >
>> > plot_Nd =
>> wrf_map_overlays(a,wks,(/contour_Nd/),pltres,res)
>> > ; plots data on a map backgrnd
>> > ; contour_Cn1 = wrf_contour(a,wks,C1_btm,res)
>> > ; plot_Cn1 = wrf_map_overlays(a,wks,(/contour_Cn1/),pltres,res)
>> > ; contour_Cn2 = wrf_contour(a,wks,C2_btm,res)
>> > ; plot_Cn2 = wrf_map_overlays(a,wks,(/contour_Cn2/),pltres,res)
>> > ; contour_Cn3 = wrf_contour(a,wks,C3_btm,res)
>> > ; plot_Cn3 = wrf_map_overlays(a,wks,(/contour_Cn3/),pltres,res)
>> > ; contour_Cn4 = wrf_contour(a,wks,C4_btm,res)
>> > ; plot_Cn4 = wrf_map_overlays(a,wks,(/contour_Cn4/),pltres,res)
>> > ; contour_Cn5 = wrf_contour(a,wks,C5_btm,res)
>> > ; plot_Cn5 = wrf_map_overlays(a,wks,(/contour_Cn5/),pltres,res)
>> > ; contour_Cn6 = wrf_contour(a,wks,C6_btm,res)
>> > ; plot_Cn6 = wrf_map_overlays(a,wks,(/contour_Cn6/),pltres,res)
>> >
>> > ; delete(contour_Nd)
>> > ; delete(contour_Cn1)
>> >
>> > ; map = wrf_map(wks,a,res)
>> > ; overlay(map,contour_Nd)
>> > ; overlay(map,contour_Cn1)
>> > ; overlay(plot0,plot3)
>> > ; gsn_panel(wks,plots,(/3,2/),True)
>> > ; draw(plot)
>> > ; frame(wks)
>> > end do
>> > end do
>> >
>> > end
>> >
>> >
>> ---------------------------------------------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > ncl-talk mailing list
>> > List instructions, subscriber options, unsubscribe:
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140804/be554295/attachment-0001.html
>>
>> ------------------------------
>>
>> Message: 4
>> Date: Mon, 4 Aug 2014 08:52:43 -0600
>> From: Mary Haley <haley at ucar.edu>
>> Subject: Re: [ncl-talk] Running example scripts for beginners
>> To: zilore mumba <zmumba at yahoo.com>
>> Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>> Message-ID:
>> <
>> CACNN_CJySFTTZvaJQbpnCE+N3mBi3BncJCF7RxZHxgMmDd41nQ at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> ?Zilore,
>>
>> WRF data is on a curvilinear grid, which means each data point is
>> represented by a unique lat/lon value. You said that "wrf_map_overlays"
>> didn't work for you, but it would help if you explain how it didn't work.
>> Did you get an error message? If so, include the error message. Did you
>> get the wrong plot? If so, indicate this. The wrf_xxxx scripts are
>> tailored
>> for WRF ARW data, so they should work pretty well.
>>
>> If you want to use the gsn_csm_xxxx scripts, you have to provide lat/lon
>> information, because the gsn_csm_xxxx scripts are *not* tailored for WRF
>> data. Otherwise NCL will have no way of knowing what map projection or
>> where your data is supposed to be overlaid on the map.
>>
>> If you are trying to use gsn_csm_contour_map and gsn_csm_contour to
>> contour
>> WRF data, then I suggest visiting this page:
>>
>> ?http://www.ncl.ucar.edu/Applications/wrfgsn.shtml
>>
>> The first example, wrf_gsn_1.ncl, is the simplest one, but it only draws
>> one field on a map.
>>
>> The last example, wrf_gsn_5.ncl, shows how to overlay multiple fields on
>> one plot. It shows how to use both gsn_csm_xxx scripts, or wrf_xxxx
>> scripts. It's up to you which one you want.
>>
>> Please look at these examples and try one of them. If you continue to
>> have
>> problems, include your script again, but this time include more
>> information
>> about what is wrong.
>>
>> Thanks,
>>
>> --Mary
>>
>>
>>
>> On Fri, Aug 1, 2014 at 4:05 PM, zilore mumba <zmumba at yahoo.com> wrote:
>>
>> > My sincere apologies for posting very basic issues. I have been trying
>> to
>> > make headway in learning ncl with very little progress. All the
>> examples I
>> > try do not seem to work. Examples,
>> >
>> >
>> >
>> >
>> >
>> >
>> > wrfout_d01_2014-07-29_00^%00^%00.nc
>> > <
>> https://www.dropbox.com/s/aeoqmfgrk6pbd99/wrfout_d01_2014-07-29_00%5E%2500%5E%2500.nc
>> >
>> > zilore mumba shared from Dropbox
>> > View on www.dropbox.com
>> > <
>> https://www.dropbox.com/s/aeoqmfgrk6pbd99/wrfout_d01_2014-07-29_00%5E%2500%5E%2500.nc
>> >
>> > Preview by Yahoo
>> >
>> >
>> > 1. I have tried the two examples on "wrf_map_overlay" examples found at
>> > wrf_map_overlays
>> > <
>> https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_map_overlays.shtml>
>> both
>> > don't work for me, only modification being the filename (which works in
>> > grads)
>> > 2. I have tried the "Getting_started example 5"found at Getting started
>> > using NCL - example 5 - contour plots over maps
>> > <
>> https://www.ncl.ucar.edu/Document/Manuals/Getting_Started/Examples/gsun05n.shtml
>> >,
>> > it does not work for me.
>> > 3. I have tried *overlay_*" examples found at
>> > https://www.ncl.ucar.edu/Applications/Scripts/overlay_1.ncl, they do
>> not
>> > work for me.
>> > I would appreciate if someone can make overlay_1.ncl (below) work for
>> me.
>> > Modifications are a) my filename and longitude and latitude of my
>> domain.
>> > The wrf output file is attached if allowed since it is too large
>> (through
>> > dropbox). I moved to Windows which does not allow : in file names.
>> > The error I get is:
>> > fatal:Dimension (bottom_top) of file (wrfout_d01_2014-07-29_00:00:00)
>> does
>> > not have an associated coordinate variable
>> > fatal:["Execute.c":8128]:Execute: Error occurred at or near line 16 in
>> > file overlay_1.ncl
>> >
>> > ;*************************************************
>> > ; overlay_1.ncl
>> > ;
>> > ; Concepts illustrated:
>> > ; - Overlaying line contours on filled contours
>> > ; - Explicitly setting contour levels
>> > ; - Selecting a different color map
>> > ;
>> > ;*************************************************
>> >
>> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> >
>> > begin
>> > a = addfile("wrfout_d01_2014-07-29_00:00:00.nc","r")
>> > temp = a->T(0,{500},:,:)
>> > uwnd = a->U(0,{500},:,:)
>> >
>> > wks = gsn_open_wks("ps","overlay")
>> > gsn_define_colormap(wks,"BlueDarkRed18") ; use the BlueDarkRed18
>> > colormap
>> >
>> > res = True
>> > res at mpFillOn = False
>> > res at mpMaxLatF = -4.07 ; specify the plot domain
>> > res at mpMinLatF = -21.9 ;
>> > res at mpMinLonF = 17.25 ;
>> > res at mpMaxLonF = 38.44 ;
>> > sres at gsnFrame = False ; do not advance the
>> frame
>> > sres at cnLevelSelectionMode = "ExplicitLevels" ; use explicit levels
>> > sres at cnLevels = ispan(-5,35,5) ; set the contour levels
>> >
>> > plot = gsn_csm_contour_map(wks,temp,res) ; create the temperature
>> plot
>> > plot_ov = gsn_csm_contour(wks,uwnd,sres) ; create the U-wind plot
>> > overlay(plot,plot_ov) ; overlay the U-wind plot
>> on
>> > the temperature plot
>> > draw(plot) ; draw the temperature
>> plot
>> > (with the U-wind plot overlaid)
>> > frame(wks) ; advance the frame
>> > end
>> >
>> > res at mpOutlineOn = True ; turn the map
>> > outline on
>> > res at gsnDraw = False ; do not draw the plot
>> >
>> >
>> >
>> >
>> > [image: image]
>> > <
>> https://www.ncl.ucar.edu/Document/Manuals/Getting_Started/Examples/gsun05n.shtml
>> >
>> >
>> >
>> >
>> >
>> >
>> > Getting started using NCL - example 5 - contour plots ov...
>> > <
>> https://www.ncl.ucar.edu/Document/Manuals/Getting_Started/Examples/gsun05n.shtml
>> >
>> > NCL Home > Documentation > Manuals > Getting Started GSUN > Examples >
>> 1 |
>> > 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11
>> > View on www.ncl.ucar.edu
>> > <
>> https://www.ncl.ucar.edu/Document/Manuals/Getting_Started/Examples/gsun05n.shtml
>> >
>> > Preview by Yahoo
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > wrf_map_overlays
>> > <
>> https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_map_overlays.shtml
>> >
>> > NCL WRFUserARW.ncl functions (graphics routines)
>> > View on www.ncl.ucar.edu
>> > <
>> https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_map_overlays.shtml
>> >
>> > Preview by Yahoo
>> >
>> >
>> >
>> > _______________________________________________
>> > ncl-talk mailing list
>> > List instructions, subscriber options, unsubscribe:
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140804/2718eee8/attachment-0001.html
>>
>> ------------------------------
>>
>> Message: 5
>> Date: Mon, 4 Aug 2014 08:55:42 -0600
>> From: Dennis Shea <shea at ucar.edu>
>> Subject: Re: [ncl-talk] read separated files
>> To: Yuqiang Zhang <yuqiangzhang.thu at gmail.com>
>> Cc: NCL <ncl-talk at ucar.edu>
>> Message-ID:
>> <
>> CAOF1d_4_aU1aywjH6CZvfAskDg276GTDvL+3c6hhZeDPHYM2RQ at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> "ListSet Type" could be used but the following may be easier.
>> https://www.ncl.ucar.edu/Document/Functions/Built-in/ListSetType.shtml
>>
>> Also, your dats is type "short"
>> https://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml
>>
>> ========
>> Please see 'addfiles'
>>
>> https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml
>>
>> ===
>> scrDir0 = "/d1/zhangg/prec/"
>> scrFile0= systemfunc("cd "+ scrDir0 +" ; ls
>> TPCAS-CMFD_V0105_B-01_"+year+".nc"
>> print(srcFile0)
>>
>> na = addfiles(srcDir0+srcFile0, "r")
>>
>> * pp = short2flt( na[:}->prec(:,107,302))*
>>
>> * printVarSummary(pp)*
>>
>>
>>
>>
>>
>> On Sat, Aug 2, 2014 at 10:35 AM, Yuqiang Zhang <
>> yuqiangzhang.thu at gmail.com>
>> wrote:
>>
>> > Hi,
>> >
>> >
>> >
>> > You can use this function ?ListSetType? to read different dimensions
>> data
>> > from multi files.
>> >
>> >
>> >
>> > Regards,
>> >
>> > Yuqiang
>> >
>> >
>> >
>> > *From:* ncl-talk-bounces at ucar.edu [mailto:ncl-talk-bounces at ucar.edu]
>> *On
>> > Behalf Of *guozfruit
>> > *Sent:* Saturday, August 02, 2014 11:38 AM
>> > *To:* NCL
>> > *Subject:* [ncl-talk] read separated files
>> >
>> >
>> >
>> > Hi all,
>> >
>> >
>> >
>> > I have 3-hr netcdf data in 12 separated files (ie for 12 months). I'm
>> > trying to extract one grid preciptation for the whole year. I have the
>> > problem about how to define one variable with different dimensions when
>> I
>> > read data from different files. Could you please help me with it?
>> Thanks.
>> >
>> >
>> >
>> > As below are the data info, and my script:
>> >
>> > dimensions:
>> >
>> > lon = 700 ;
>> >
>> > lat = 400 ;
>> >
>> > time = UNLIMITED ;
>> >
>> > short prec(time, lat, lon) ;
>> >
>> > prec:scale_factor = 0.002f ;
>> >
>> > prec:add_offset = 50.f ;
>> >
>> > prec:_Fill_Value = -32767s ;
>> >
>> > prec:missing_value = -32767s ;
>> >
>> > prec:units = "mm hr-1" ;
>> >
>> > prec:long_name = "Precipitation rate" ;
>> >
>> >
>> >
>> >
>> >
>> > year = 2008
>> >
>> > mon = 12
>> >
>> > nhour = new(mon,integer)
>> >
>> >
>> >
>> > if(year .eq. 2008) then
>> >
>> > day_leap = (/31,29,31,30,31,30,31,31,30,31,30,31/)
>> >
>> > do i = 0,mon-1
>> >
>> > nhour(i) = day_leap(i)*8
>> >
>> > end do
>> >
>> > else
>> >
>> > day_nonleap = (/31,28,31,30,31,30,31,31,30,31,30,31/)
>> >
>> > do i = 0,mon-1
>> >
>> > nhour(i) = day_nonleap(i)*8
>> >
>> > end do
>> >
>> > end if
>> >
>> >
>> >
>> > *pp = new((/12,nhour/),float)*
>> >
>> > do imon = 1,12
>> >
>> > if(imon.lt.10) then
>> >
>> > mon3 = "0"+imon
>> >
>> > else
>> >
>> > mon3 = ""+imon
>> >
>> > end if
>> >
>> > scrDir0 = "/d1/zhangg/prec/"
>> >
>> > do ifl = 0,nhour(imon-1)-1
>> >
>> > na =
>> > addfile(scrDir0+"prec_ITPCAS-CMFD_V0105_B-01_"+year+mon3+".nc","r")
>> >
>> > * pp(imon-1,ifl) = na->prec(:,107,302)*
>> >
>> > end do
>> >
>> > end do
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > X
>> >
>> > _______________________________________________
>> > ncl-talk mailing list
>> > List instructions, subscriber options, unsubscribe:
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140804/5bf2441c/attachment-0001.html
>>
>> ------------------------------
>>
>> Message: 6
>> Date: Mon, 4 Aug 2014 15:16:12 +0000
>> From: Lauren Jean Vargo <lvargo at unm.edu>
>> Subject: [ncl-talk] Using a loop to find values greater than 0
>> (calculate PDD)
>> To: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>> Message-ID: <70D79029-3BC6-4860-8081-E5C280D91F93 at unm.edu>
>> Content-Type: text/plain; charset="Windows-1252"
>>
>> Hello,
>>
>> I?m having trouble doing a calculation with NCL, ultimately I am trying
>> to calculate the Positive degree-day (PDD) sum. I?ve read in daily
>> temperature data (which is 3D [time,lat,lon]). What I am trying to do is
>> calculate the sum of the temperatures that are greater than 0C for 1 year.
>>
>> The way I was trying to do this was with a loop, and to first set any
>> temperature less than or equal to zero, just to zero. Next I want to sum
>> all the temperatures over 365 days at each lat & lon point. If there is an
>> easier way to do this using NCL functions, that would be great.
>>
>> The error message that I am getting is that the ?loop must be scalar".
>> However, I?m not sure how to specify that I want the temperature value to
>> be analyzed when tasC is (time,lat,lon).
>>
>> I?ve uploaded the file "tas_day_CCSM4_lgm_r2i1p1_18700101-19001231.nc? to
>> the ftp account.
>>
>> I?m running ncl version 6.1.2, and the system is Darwin Kernel Version
>> 13.3.0
>>
>>
>> Here is the script:
>>
>> 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"
>>
>> begin
>>
>> ; Read in near surface air temperature (Ta)
>>
>> a =
>> addfile("tas_day_CCSM4_lgm_r2i1p1_18700101-19001231.nc","r")
>> tasL = a->tas(0:364,:,:)
>> tasC = tasL - 273.15 ; Convert K to C
>> print (tasC)
>> printVarSummary (tasC)
>>
>> do tasC = 0,364
>> if (tasC .le. 0)
>> H = 0
>> end if
>> end do
>>
>> PDD_sum = dim_cumsum_n_Wrap(tasC)
>>
>> end
>>
>>
>> Any help would be greatly appreciated.
>>
>> Thanks,
>>
>> Lauren Vargo
>> M.S. Candidate
>> The University of New Mexico
>>
>> ------------------------------
>>
>> Message: 7
>> Date: Mon, 4 Aug 2014 10:11:24 -0600
>> From: Dennis Shea <shea at ucar.edu>
>> Subject: Re: [ncl-talk] Using a loop to find values greater than 0
>> (calculate PDD)
>> To: Lauren Jean Vargo <lvargo at unm.edu>
>> Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>> Message-ID:
>> <CAOF1d_5=0d_Fd0HP_1aOnzafkOmiScwouqZhZbD=
>> dSzzozwDbw at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> The variable, tasC, is an *array *
>>
>> tasC = tasL - 273.15 ; Convert K to C
>> printVarSummary(tasC)
>>
>> You can not use an array as a loop variable ... in any language.
>>
>> do tasC = 0,364
>>
>> could be, say,
>>
>> do day = 0,364
>>
>> See:
>>
>> https://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclStatements.shtml#Loops
>>
>> Specifically:
>>
>> do *loop_identifier* = *scalar_start_expr* ,
>>
>> *end_expr*
>>
>> *T*he "scalar_start_expr , end_expr" are scalar.
>>
>>
>>
>> ===
>>
>> a = addfile("tas_day_CCSM4_lgm_
>> r2i1p1_18700101-19001231.nc","r")
>> tasL = a->tas(0:364,:,:)
>>
>> TIME = cd_calendar(tasL&time,0) ; TIME(ntim,6)
>> print(TIME)
>>
>> tasC = tasL - 273.15 ; Convert K to C
>> tasC = where(tasC.gt.0.0, tasc, 0.0)
>> pdd = dim_sum_n_Wrap(tasC, 0) ; (lat,lon)
>> pdd at long_name = "degree days for year="+toint(TIME(0,0))
>> pdd at units = "degC"
>>
>>
>>
>>
>> On Mon, Aug 4, 2014 at 9:16 AM, Lauren Jean Vargo <lvargo at unm.edu> wrote:
>>
>> > Hello,
>> >
>> > I?m having trouble doing a calculation with NCL, ultimately I am trying
>> to
>> > calculate the Positive degree-day (PDD) sum. I?ve read in daily
>> temperature
>> > data (which is 3D [time,lat,lon]). What I am trying to do is calculate
>> the
>> > sum of the temperatures that are greater than 0C for 1 year.
>> >
>> > The way I was trying to do this was with a loop, and to first set any
>> > temperature less than or equal to zero, just to zero. Next I want to sum
>> > all the temperatures over 365 days at each lat & lon point. If there is
>> an
>> > easier way to do this using NCL functions, that would be great.
>> >
>> > The error message that I am getting is that the ?loop must be scalar".
>> > However, I?m not sure how to specify that I want the temperature value
>> to
>> > be analyzed when tasC is (time,lat,lon).
>> >
>> > I?ve uploaded the file "tas_day_CCSM4_lgm_r2i1p1_18700101-19001231.nc?
>> to
>> > the ftp account.
>> >
>> > I?m running ncl version 6.1.2, and the system is Darwin Kernel Version
>> > 13.3.0
>> >
>> >
>> > Here is the script:
>> >
>> > 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"
>> >
>> > begin
>> >
>> > ; Read in near surface air temperature (Ta)
>> >
>> > a =
>> > addfile("tas_day_CCSM4_lgm_r2i1p1_18700101-19001231.nc","r")
>> > tasL = a->tas(0:364,:,:)
>> > tasC = tasL - 273.15 ; Convert K to C
>> > print (tasC)
>> > printVarSummary (tasC)
>> >
>> > do tasC = 0,364
>> > if (tasC .le. 0)
>> > H = 0
>> > end if
>> > end do
>> >
>> > PDD_sum = dim_cumsum_n_Wrap(tasC)
>> >
>> > end
>> >
>> >
>> > Any help would be greatly appreciated.
>> >
>> > Thanks,
>> >
>> > Lauren Vargo
>> > M.S. Candidate
>> > The University of New Mexico
>> > _______________________________________________
>> > ncl-talk mailing list
>> > List instructions, subscriber options, unsubscribe:
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140804/571eb834/attachment-0001.html
>>
>> ------------------------------
>>
>> Message: 8
>> Date: Mon, 4 Aug 2014 11:36:03 -0500
>> From: Kyle Griffin <ksgriffin2 at wisc.edu>
>> Subject: Re: [ncl-talk] Using a loop to find values greater than 0
>> (calculate PDD)
>> To: Lauren Jean Vargo <lvargo at unm.edu>
>> Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>> Message-ID:
>> <CAKt9o=gyy9Wtwyuv3J32VTubo9zrZVmFFh5LAuN5oju5F6=
>> 8bg at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> This also sounds like an ideal spot for implementing the 'where' function.
>>
>> https://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml
>>
>> pos_dd = where(tasC.ge.0,tasC,tasC at _FillValue)
>> total_pos_dd = dim_sum_n_Wrap(pos_dd,0)
>>
>> This will assign the missing value of tasC to any location in the array
>> that is greater than or equal to zero and have each point less than zero
>> assigned to the missing value (usually in the _FillValue attribute. If
>> tasC at _FillValue
>> is not set, you can set it to anything). You can then add up the values
>> over the 0th dimension (time) to get a total at each lat/lon point.
>>
>> Hope that helps,
>>
>>
>> Kyle
>>
>> ----------------------------------------
>> Kyle S. Griffin
>> Department of Atmospheric and Oceanic Sciences
>> University of Wisconsin - Madison
>> Room 1421
>> 1225 W Dayton St, Madison, WI 53706
>> Email: ksgriffin2 at wisc.edu
>>
>>
>> On Mon, Aug 4, 2014 at 11:11 AM, Dennis Shea <shea at ucar.edu> wrote:
>>
>> > The variable, tasC, is an *array *
>> >
>> > tasC = tasL - 273.15 ; Convert K to C
>> > printVarSummary(tasC)
>> >
>> > You can not use an array as a loop variable ... in any language.
>> >
>> > do tasC = 0,364
>> >
>> > could be, say,
>> >
>> > do day = 0,364
>> >
>> > See:
>> >
>> >
>> https://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclStatements.shtml#Loops
>> >
>> > Specifically:
>> >
>> > do *loop_identifier* = *scalar_start_expr* ,
>> >
>> > *end_expr*
>> >
>> > *T*he "scalar_start_expr , end_expr" are scalar.
>> >
>> >
>> >
>> > ===
>> >
>> > a = addfile("tas_day_CCSM4_lgm_
>> > r2i1p1_18700101-19001231.nc","r")
>> > tasL = a->tas(0:364,:,:)
>> >
>> > TIME = cd_calendar(tasL&time,0) ; TIME(ntim,6)
>> > print(TIME)
>> >
>> > tasC = tasL - 273.15 ; Convert K to C
>> > tasC = where(tasC.gt.0.0, tasc, 0.0)
>> > pdd = dim_sum_n_Wrap(tasC, 0) ; (lat,lon)
>> > pdd at long_name = "degree days for
>> year="+toint(TIME(0,0))
>> > pdd at units = "degC"
>> >
>> >
>> >
>> >
>> > On Mon, Aug 4, 2014 at 9:16 AM, Lauren Jean Vargo <lvargo at unm.edu>
>> wrote:
>> >
>> >> Hello,
>> >>
>> >> I?m having trouble doing a calculation with NCL, ultimately I am trying
>> >> to calculate the Positive degree-day (PDD) sum. I?ve read in daily
>> >> temperature data (which is 3D [time,lat,lon]). What I am trying to do
>> is
>> >> calculate the sum of the temperatures that are greater than 0C for 1
>> year.
>> >>
>> >> The way I was trying to do this was with a loop, and to first set any
>> >> temperature less than or equal to zero, just to zero. Next I want to
>> sum
>> >> all the temperatures over 365 days at each lat & lon point. If there
>> is an
>> >> easier way to do this using NCL functions, that would be great.
>> >>
>> >> The error message that I am getting is that the ?loop must be scalar".
>> >> However, I?m not sure how to specify that I want the temperature value
>> to
>> >> be analyzed when tasC is (time,lat,lon).
>> >>
>> >> I?ve uploaded the file "tas_day_CCSM4_lgm_r2i1p1_18700101-19001231.nc?
>> to
>> >> the ftp account.
>> >>
>> >> I?m running ncl version 6.1.2, and the system is Darwin Kernel Version
>> >> 13.3.0
>> >>
>> >>
>> >> Here is the script:
>> >>
>> >> 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"
>> >>
>> >> begin
>> >>
>> >> ; Read in near surface air temperature (Ta)
>> >>
>> >> a =
>> >> addfile("tas_day_CCSM4_lgm_r2i1p1_18700101-19001231.nc","r")
>> >> tasL = a->tas(0:364,:,:)
>> >> tasC = tasL - 273.15 ; Convert K to C
>> >> print (tasC)
>> >> printVarSummary (tasC)
>> >>
>> >> do tasC = 0,364
>> >> if (tasC .le. 0)
>> >> H = 0
>> >> end if
>> >> end do
>> >>
>> >> PDD_sum = dim_cumsum_n_Wrap(tasC)
>> >>
>> >> end
>> >>
>> >>
>> >> Any help would be greatly appreciated.
>> >>
>> >> Thanks,
>> >>
>> >> Lauren Vargo
>> >> M.S. Candidate
>> >> The University of New Mexico
>> >> _______________________________________________
>> >> 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
>> >
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140804/17872935/attachment-0001.html
>>
>> ------------------------------
>>
>> Message: 9
>> Date: Mon, 4 Aug 2014 10:52:57 -0600
>> From: Mary Haley <haley at ucar.edu>
>> Subject: Re: [ncl-talk] Strange white lines across plot
>> To: Michael Notaro <mnotaro at wisc.edu>
>> Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>> Message-ID:
>> <
>> CACNN_CJk8ojmqz8L3oqZiTw2ERjJF6S3xmwprTO--fT7jtnTSQ at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Hi Michael,
>>
>> I really don't have any idea about this one. We did fix a bug in V6.1.2
>> that caused thin white lines to show up, but this doesn't look like a case
>> of that.
>>
>> Can you provide your VAR3 variable, say in a NetCDF file, so we can try
>> running your script here?
>>
>> --Mary
>>
>>
>> On Fri, Aug 1, 2014 at 4:10 PM, Michael Notaro <mnotaro at wisc.edu> wrote:
>>
>> >
>> > I am using NCL 6.1.2. Please see the attached plot
>> >
>> > and note the odd white lines across the figure. Any
>> >
>> > idea what caused it and how to remove it?
>> >
>> >
>> >
>> >
>> > The plotting lines are listed below.
>> >
>> >
>> >
>> >
>> > If I change the data values in the plot to some
>> >
>> > arbitrary value, sometimes the lines go away.
>> >
>> >
>> >
>> >
>> > Michael
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > wks=gsn_open_wks("ps","bar_revised2")
>> >
>> > gsn_define_colormap(wks, "NCV_blue_red")
>> >
>> >
>> >
>> >
>> > res = True
>> >
>> > res at gsnDraw = False
>> >
>> > res at gsnFrame = False
>> >
>> > res at cnRasterModeOn=True
>> >
>> > res at cnFillDrawOrder = "PreDraw"
>> >
>> > res at tmXTOn = False
>> >
>> > res at tmXTBorderOn = False
>> >
>> > res at tmYROn = False
>> >
>> > res at tmYRBorderOn = False
>> >
>> > res at tmXBOn = False
>> >
>> > res at tmXBBorderOn = False
>> >
>> > res at tmYLOn = False
>> >
>> > res at tmYLBorderOn = False
>> >
>> > res at lbLabelFont = 25
>> >
>> > res at lbLabelFontHeightF = 0.012
>> >
>> > res at lbBottomMarginF = 0.5
>> >
>> > res at lbTopMarginF = 0.25
>> >
>> > res at cnFillOn = True
>> >
>> > res at cnLinesOn = False
>> >
>> > res at cnLevelSelectionMode = "ManualLevels"
>> >
>> >
>> >
>> >
>> > lower=int2flt(floattointeger(min(VAR3)*100.))/100.
>> >
>> > upper=int2flt(floattointeger(max(VAR3)*100.))/100.
>> >
>> > delta=fabs(lower-upper)
>> >
>> >
>> >
>> >
>> > res at cnLevelSpacingF=0.01
>> >
>> >
>> >
>> >
>> > if ( (delta.ge.0.).and.(delta.lt.0.0025) ) then
>> >
>> > res at cnLevelSpacingF=0.00001
>> >
>> > end if
>> >
>> > if ( (delta.ge.0.0025).and.(delta.lt.0.025) ) then
>> >
>> > res at cnLevelSpacingF=0.0001
>> >
>> > end if
>> >
>> > if ( (delta.ge.0.025).and.(delta.lt.0.25) ) then
>> >
>> > res at cnLevelSpacingF=0.001
>> >
>> > end if
>> >
>> > if ( (delta.ge.0.25).and.(delta.lt.2.5) ) then
>> >
>> > res at cnLevelSpacingF=0.01
>> >
>> > end if
>> >
>> > if ( (delta.ge.2.5).and.(delta.lt.25.0) ) then
>> >
>> > res at cnLevelSpacingF=0.1
>> >
>> > end if
>> >
>> > if ( (delta.ge.25.).and.(delta.lt.250) ) then
>> >
>> > res at cnLevelSpacingF=1.0
>> >
>> > end if
>> >
>> > if ( (delta.ge.250.).and.(delta.lt.2500.) ) then
>> >
>> > res at cnLevelSpacingF=10.0
>> >
>> > end if
>> >
>> >
>> >
>> >
>> > res at gsnSpreadColors=True
>> >
>> >
>> >
>> >
>> > if ( (lower.ge.0.).and.(upper.ge.0.) ) then
>> >
>> > res at gsnSpreadColorStart=120
>> >
>> > res at gsnSpreadColorEnd=2
>> >
>> > end if
>> >
>> > if ( (lower.le.0.).and.(upper.le.0.) ) then
>> >
>> > res at gsnSpreadColorStart=255
>> >
>> > res at gsnSpreadColorEnd=137
>> >
>> > end if
>> >
>> >
>> >
>> >
>> > if ( (lower.lt.0.).and.(upper.gt.0.) ) then
>> >
>> > ratio=fabs(lower)/fabs(upper)
>> >
>> > res at gsnSpreadColorStart=255
>> >
>> > res at gsnSpreadColorEnd=128-floattointeger(128./ratio)
>> >
>> > end if
>> >
>> >
>> >
>> >
>> > res at cnMinLevelValF=lower
>> >
>> > res at cnMaxLevelValF=upper
>> >
>> >
>> >
>> >
>> > res at lbBoxLinesOn=False
>> >
>> >
>> >
>> >
>> >
>> >
>> > plot = gsn_csm_contour(wks, VAR3, res)
>> >
>> > _______________________________________________
>> > ncl-talk mailing list
>> > List instructions, subscriber options, unsubscribe:
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140804/8f82b7fe/attachment-0001.html
>>
>> ------------------------------
>>
>> Message: 10
>> Date: Mon, 4 Aug 2014 10:58:51 -0600
>> From: Mary Haley <haley at ucar.edu>
>> Subject: Re: [ncl-talk] Fwd: Masking a U.S. county from a netcdf file
>> To: Mohammadhassan Mohegh <mohegh at usc.edu>
>> Cc: ncl-talk <ncl-talk at ucar.edu>
>> Message-ID:
>> <CACNN_CLmsqp6fP8Q50GDM=
>> ebG+4RZhFgugzK8c04fHkeExH-3A at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Hi,
>>
>> You can use a combination of shapefiles and the "gc_inout" function in
>> order to collect values for a given county and get an average.
>>
>> My suggestion is to use the USA_adm2.shp shapefile downloaded from
>> gadm.org/country, and then look at example "shapefiles_13.ncl" at:
>>
>> http://www.ncl.ucar.edu/Applications/shapefiles.shtml#ex13
>>
>> You can also look at the example right after that, which does the same
>> thing for the coastal counties of Germany, "
>> Germany_coastal_counties_DEU_adm.ncl
>> <
>> http://www.ncl.ucar.edu/Applications/Scripts/Germany_coastal_counties_DEU_adm.ncl
>> >
>> ".
>>
>> The "shapefiles_13.ncl" example only does the counties of Georgia. Let me
>> know if you need help extending it to do all the counties of the US. It
>> would help, however, if you could provide me with your two WRF output
>> files.
>>
>> --Mary
>>
>>
>>
>> On Thu, Jul 31, 2014 at 5:09 PM, Mohammadhassan Mohegh <mohegh at usc.edu>
>> wrote:
>>
>> >
>> > Hi
>> >
>> > I'm working with WRF model output and I need to average the differences
>> of
>> > 2 outputs within a county. Is there any way to do this? Are there
>> > shapefiles or netcdf files available for US counties that NCL
>> recognizes?
>> >
>> > I have created a netcdf file containing these counties using ARCGIS. The
>> > problem is that it does not have the same grid and I can't use the
>> mask()
>> > function with it. Does any one know of a
>> >
>> > Thanks in advance for your help.
>> >
>> >
>> >
>> > --
>> > Mohammadhassan Mohegh, PhD student
>> > Astani Dept of Civil and Environmental Engineering
>> > University of Southern California
>> > 3620 South Vermont Ave, KAP227
>> > Los Angeles, CA
>> > mohegh at usc.edu
>> >
>> > _______________________________________________
>> > ncl-talk mailing list
>> > List instructions, subscriber options, unsubscribe:
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140804/8992036d/attachment-0001.html
>>
>> ------------------------------
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> End of ncl-talk Digest, Vol 129, Issue 4
>> ****************************************
>>
>
>
>
> --
> With regards
> Saurabh Kumar singh
>
> *P** : * *Please consider the environment before printing this e-mail*
>
>
>
>
> =====================
> 名称: 中国气象局上海台风研究所
> 地址: 中国上海市徐汇区蒲西路166号
> 电话:(+86)021-64391966
> 传真:(+86)021-64391966
> ============================
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140805/402d711b/attachment.html
More information about the ncl-talk
mailing list