X axis starts at -0.5 on XY plot

From: Li, Yongzuo <yongzuo.li_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 11 2010 - 00:02:46 MDT

Hi Adam,

Thanks for your help. The problem is solved now.

Yongzuo
________________________________________
From: ncl-talk-bounces@ucar.edu [ncl-talk-bounces@ucar.edu] on behalf of ncl-talk-request@ucar.edu [ncl-talk-request@ucar.edu]
Sent: Thursday, June 10, 2010 1:00 PM
To: ncl-talk@ucar.edu
Subject: ncl-talk Digest, Vol 79, Issue 22

Send ncl-talk mailing list submissions to
        ncl-talk@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@ucar.edu

You can reach the person managing the list at
        ncl-talk-owner@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. stringtofloat (Li, Yongzuo)
   2. Re: Question on Wave number frequency spectra (Dennis Shea)
   3. Re: stringtofloat (David Brown)
   4. Re: stringtofloat (Wei Huang)
   5. undefined identifier error message (Ioana Colfescu)
   6. Re: undefined identifier error message (Dennis Shea)
   7. Re: Contouring temperature with GFS dataset. (Mary Haley)
   8. Re: Contouring temperature with GFS dataset. (Caroline Serraud)
   9. Precipitation Rate Calculation (Sahidul)
  10. XY plot (Li, Yongzuo)
  11. Re: XY plot (Adam Phillips)
  12. Re: Contouring temperature with GFS dataset. (David Brown)

----------------------------------------------------------------------

Message: 1
Date: Wed, 9 Jun 2010 23:41:01 +0000
From: "Li, Yongzuo" <yongzuo.li@ou.edu>
Subject: stringtofloat
To: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
Message-ID:
        <3D70D3147AC59C42A3C346D8F9FA2A0A29958070@it-monad.sooner.net.ou.edu>
Content-Type: text/plain; charset="us-ascii"

 Hi,

I have a script to test stringtofloat

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin

s = "2008090100"
f = stringtofloat(s)
i = stringtoint(s)

print("string= "+s)
print("float= "+f)
print("int= "+i)

end

The output for float is wrong

(0) string= 2008090100
(0) float= 2.00809e+09
(0) int= 2008090100

Yongzuo

------------------------------

Message: 2
Date: Wed, 09 Jun 2010 18:14:55 -0600
From: Dennis Shea <shea@ucar.edu>
Subject: Re: Question on Wave number frequency spectra
To: gibies george <gibiesgeorge@gmail.com>
Cc: ncl-talk@ucar.edu
Message-ID: <4C102E7F.9030406@ucar.edu>
Content-Type: text/plain; charset="iso-8859-1"

The MJO scripts were written to do what the referenced article
suggested. Beyond that, **there is no support**.

[1]
Switching the AXIS is 'easy'[attached]

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl"
load "./mjo_wavenum_freq_season_plot.ncl_gibies"

[2]
Possibly, but it would require work and **I can offer no support**.

You could extract "mjo_wavenum_freq_season" from diagnostics_cam.ncl

%> vi $NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl

create a separate file and modify it.
Also, the
http://www.ncl.ucar.edu/Document/Functions/Diagnostics/resolveWavesHayashi.shtml

which is used is pretty much expecting (time,lon)

Good luck

On 6/9/10 4:35 AM, gibies george wrote:
> NCL Users,
>
> I have two questions regarding wave number frequency spectra:
>
> First Question: I want to calculate the wave number frequency spectrum
> for each season. So I used example10
> (mjoclivar_10.ncl) in the MJO clivar..But in that example X axis is
> frequency (-0.05 to 0.05) and Y axis is wave number..But actually I want
> wave number in X axis ( varies from -15 to 15) and period in Y-axis. So
> what are the changes I want to make for that..?
>
> Second Question: can I use the same example for calculating spectra
> for north south direction by giving x(time,lat) as the input to
> mjo_wavenum_freq_season function. So that fft can be apply to latitude..
>
> Thanking you in advance
>
>
> Gibies George,CSIR-RF,
> Climate and Global Modelling Division,
> Indian Institute of Tropical Meteorology,
> Dr. Homi Bhabha Road,
> NCL (P. O.), Pashan,
> Pune 411008, India.
>
> http://sites.google.com/site/gibiesge/
>
> Think about the environment. Please don't print this e-mail unless it is
> necessary.
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mjo_wavenum_freq_season_plot.ncl_gibies
Url: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20100609/6ad2d0ad/attachment.pl

------------------------------

Message: 3
Date: Wed, 9 Jun 2010 18:23:25 -0600
From: David Brown <dbrown@ucar.edu>
Subject: Re: stringtofloat
To: "Li, Yongzuo" <yongzuo.li@ou.edu>
Cc: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
Message-ID: <16CBDFBE-294E-4749-B89F-0E52CF94A92E@ucar.edu>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

Hi Yongzuo,

The float type only has a precision of between 6 and 7 decimal places.
In order to represent 10 digits precisely you need to use double.

However, you should also be aware that the default printed value for
float types rounds to 6 digits of precision. The value stored
internally and used for calculations is not likely to be exactly equal
to the printed value. You can print out a more precise version of the
internal value using the 'sprintf' routine:

ncl 10> print(sprintf("%10f",f))
(0) 2008090112.000000

It's not exactly the number you started with, but it's closer than it
looks using a simple print command. However, you still need to use
double to get the necessary precision to represent a date accurately.

  -dave

On Jun 9, 2010, at 5:41 PM, Li, Yongzuo wrote:

> Hi,
>
> I have a script to test stringtofloat
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> begin
>
> s = "2008090100"
> f = stringtofloat(s)
> i = stringtoint(s)
>
> print("string= "+s)
> print("float= "+f)
> print("int= "+i)
>
> end
>
> The output for float is wrong
>
> (0) string= 2008091000
> (0) float= 2.00809e+09
> (0) int= 2008090100
>
> Yongzuo
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

------------------------------

Message: 4
Date: Wed, 9 Jun 2010 21:39:40 -0600
From: Wei Huang <huangwei@ucar.edu>
Subject: Re: stringtofloat
To: "Li, Yongzuo" <yongzuo.li@ou.edu>
Cc: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
Message-ID: <CF03629C-BD06-4E58-932B-28C8B98A50DB@ucar.edu>
Content-Type: text/plain; charset=US-ASCII; format=flowed

Yongzhou,

As Dave pointed out, it is better you use double to represent the date.

Or you can use NCL's newly added data type: int64, or uint64.

For example, you may have:

s = "20080901000000"
i64 = toint64(s)
ui64 = touint64(s)
d = todouble(s)

print(i64)
print(ui64)
print(d)

will give you:

Variable: i64
Type: int64
Total Size: 8 bytes
             1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) 20080901000000

Variable: ui64
Type: uint64
Total Size: 8 bytes
             1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) 20080901000000

Variable: d
Type: double
Total Size: 8 bytes
             1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) 20080901000000

You may also noticed there are new convert functions as well.

Hope this help,

Wei Huang
huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

On Jun 9, 2010, at 5:41 PM, Li, Yongzuo wrote:

> Hi,
>
> I have a script to test stringtofloat
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> begin
>
> s = "2008090100"
> f = stringtofloat(s)
> i = stringtoint(s)
>
> print("string= "+s)
> print("float= "+f)
> print("int= "+i)
>
> end
>
> The output for float is wrong
>
> (0) string= 2008090100
> (0) float= 2.00809e+09
> (0) int= 2008090100
>
> Yongzuo
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

------------------------------

Message: 5
Date: Thu, 10 Jun 2010 09:28:11 -0400 (EDT)
From: Ioana Colfescu <colfescu@cola.iges.org>
Subject: undefined identifier error message
To: ncl-talk <ncl-talk@ucar.edu>
Message-ID:
        <1412635020.5379.1276176491183.JavaMail.root@mail.iges.org>
Content-Type: text/plain; charset=utf-8

Hi,

Could anybody please help me with the following problem - when I run a code that contains the following part :

iopt = 0
jave = 0 ; no smoothing; return periodogram estimates
pct = 0.1 ; taper 10% of the data
dof = specx_anal(lat_lon_ave(:),iopt,jave,pct)
printVarSummary(dof)
splt = specx_ci(dof,0.05,0.95)

I get the error message :

fatal:Undefined identifier: (specx_ci) is undefined, can't continue
fatal:Execute: Error occurred at or near line 22 in file slect_reg.ncl

Is weird since I copy pasted this from another code where the same lines work fine so I don't understand what's happening here.
Thank you,

Ioana

------------------------------

Message: 6
Date: Thu, 10 Jun 2010 09:10:49 -0600
From: Dennis Shea <shea@ucar.edu>
Subject: Re: undefined identifier error message
To: Ioana Colfescu <colfescu@cola.iges.org>
Cc: ncl-talk <ncl-talk@ucar.edu>
Message-ID: <4C110079.9030207@ucar.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

http://www.ncl.ucar.edu/Document/Functions/Shea_util/specx_ci.shtml

As noted, this is in the "shea_util.ncl"library.

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"

Good luck

On 6/10/10 7:28 AM, Ioana Colfescu wrote:
> Hi,
>
> Could anybody please help me with the following problem - when I run a code that contains the following part :
>
> iopt = 0
> jave = 0 ; no smoothing; return periodogram estimates
> pct = 0.1 ; taper 10% of the data
> dof = specx_anal(lat_lon_ave(:),iopt,jave,pct)
> printVarSummary(dof)
> splt = specx_ci(dof,0.05,0.95)
>
> I get the error message :
>
> fatal:Undefined identifier: (specx_ci) is undefined, can't continue
> fatal:Execute: Error occurred at or near line 22 in file slect_reg.ncl
>
> Is weird since I copy pasted this from another code where the same lines work fine so I don't understand what's happening here.
> Thank you,
>
> Ioana
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

------------------------------

Message: 7
Date: Thu, 10 Jun 2010 09:43:14 -0600
From: Mary Haley <haley@ucar.edu>
Subject: Re: Contouring temperature with GFS dataset.
To: Caroline Serraud <cs@meteoconsult.fr>
Cc: ncl-talk NCL <ncl-talk@ucar.edu>
Message-ID: <5F4CF129-79B3-445E-B13D-6AF5E7565A7D@ucar.edu>
Content-Type: text/plain; charset=iso-8859-1

Caroline,

The problem appears to be with setting gsnBoxMargin to 0.0.
This is causing an internal value of 1.0 to be calculated for vpWidthF and
0.0 for vpXF which NCL doesn't like for this particular case.

Is there a reason you need the plot to be as big as possible? Until we get a fix for this,
we might be able to provide you with a work-around if I know what you need to do with
the image.

For example, I've had good results with making an image larger and trimming all white space
by using ImageMagick's "convert" utility, along with "-trim" to remove white space, and
"-geometry" to increase the geometry.

--Mary

On Jun 7, 2010, at 9:35 AM, Mary Haley wrote:

> Hi Caroline,
>
> This sounds like a possible memory problem.
>
> I would like to be able to run your script here .
>
> Can you set:
>
> res@gsnDebugWriteFileName = "serraud"
>
> and rerun your script? This will create "serraud.nc", "serraud.ncl" and "serraud.res".
> If you can then email me serraud.nc and serraud.ncl I can run it here. I don't need the *.res file.
>
> If the data file is too big (> 10 Mb), let me know.
>
> Thanks,
>
> --Mary
>
>
>
>
> On Jun 7, 2010, at 9:03 AM, Caroline Serraud wrote:
>
>> Hello everyone,
>>
>> I am facing some trouble to plot contour of 2m-temperature from GFS data downloaded from NCEP FTP site (for example, gfs.t18z.pgrb2f06)
>> NCL crashes when I run my script with default contour fill mode (area fill mode) but is ok with RasterFill mode.
>>
>> But with a 0,5? resolution I would really appreciate area mode because raster mode is not that pretty (see example attached)
>> Did someone already experience plotting filled contour for 2m-temperature from GFS?
>>
>> Caroline
>>
>> --
>> Caroline Serraud - Ing?nieur Etudes & D?veloppements
>> ------------------------------------------------------
>> METEO CONSULT / La Chaine M?t?o - Groupe Figaro
>> D?partement Informatique
>> Domaine de Marsinval F-78540 Vernouillet, FRANCE
>> T?l : 01 39 28 1990 - Fax : 01 39 71 85 31
>> e-mail : cs@meteoconsult.fr
>> ------------------------------------------------------
>> Toute la m?t?o sur le Web : http://www.meteoconsult.fr
>> Toute la m?t?o par t?l?phone : 3201
>> ;*************************************************
>> ; tempe_gfs.ncl
>> ;************************************************
>> 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
>> if (.not.isvar("v_file")) then
>> print("Le nom du fichier source n'est pas defini")
>> exit()
>> end if
>> ;************************************************
>> ; read in netCDF file
>> ;************************************************
>> a = addfile(v_file,"r")
>> ;************************************************
>> ; read in zonal [u] and meridional [v] winds
>> ;************************************************
>> t = a->TMP_P0_L103_GLL0(:,:)
>> t = t - 273.15
>> delete(t@units)
>> delete(t@long_name)
>>
>>
>> i_lat_min = v_lat_min + 0
>> i_lat_max = v_lat_max + 0
>> i_lon_min = v_lon_min + 0
>> i_lon_max = v_lon_max + 0
>>
>> ;************************************************
>> ; create plot
>> ;************************************************
>> wks_type = "ps"
>> wks =gsn_open_wks(wks_type,"tempe")
>>
>> gsn_define_colormap(wks,"BlWhRe") ; choose color map
>>
>> res = True ; plot mods desired
>> res@gsnMaximize = True
>> res@gsnPaperOrientation = "landscape"
>> res@gsnBoxMargin = 0.0
>> res@gsnAddCyclic = False ; regional data
>>
>> res@lbLabelBarOn = False
>>
>> res@tmXBOn = False ; don't draw axis nor axis labels
>> res@tmXTOn = False
>> res@tmYLOn = False
>> res@tmYROn = False
>>
>> res@cnLevelSelectionMode = "ManualLevels"
>> res@cnMinLevelValF = -15.
>> res@cnMaxLevelValF = 35.
>> res@cnLevelSpacingF = 1.
>> res@cnFillOn = True ; turn on color for contours
>> res@cnLinesOn = False ; turn off contour lines
>> res@cnLineLabelsOn = False ; turn off contour line labels
>> res@cnFillColors = ispan(2,102,2)
>> res@cnInfoLabelOn = False
>> ; res@cnFillMode = "RasterFill"
>>
>> ; zoom in on map
>>
>> res@mpDataBaseVersion = "RANGS_GSHHS" ; high resolution coastline
>> res@mpDataResolution = "FinestResolution"
>> res@mpFillOn = False
>> res@mpOutlineOn = False
>> res@mpPerimOn = False
>>
>>
>> res@mpProjection = "mercator"
>> res@mpLimitMode = "Corners"
>> res@mpLeftCornerLatF = i_lat_min
>> res@mpLeftCornerLonF = i_lon_min
>> res@mpRightCornerLatF = i_lat_max
>> res@mpRightCornerLonF = i_lon_max
>>
>>
>> plot=gsn_csm_contour_map(wks,t,res)
>>
>> end
>>
>>
>> <1_tmp2m_2010060709.png>_______________________________________________
>> 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

------------------------------

Message: 8
Date: Thu, 10 Jun 2010 18:02:34 +0200
From: Caroline Serraud <cs@meteoconsult.fr>
Subject: Re: Contouring temperature with GFS dataset.
To: Mary Haley <haley@ucar.edu>
Cc: ncl-talk NCL <ncl-talk@ucar.edu>
Message-ID: <4C110C9A.2020403@meteoconsult.fr>
Content-Type: text/plain; charset="iso-8859-1"

Hi Mary,

You're totally right, when I comment out the gsnBoxMargin resource, the
script works fine.
In fact, I already use ImageMagick's convert with -trim option to remove
white space that I obtained even with the gsnBoxMargin resource, so
commenting it out doesn't bother me at all.

Thank you very much for your help, I would never have suspected that
specific resource!
Caroline

Mary Haley a ?crit :
> Caroline,
>
> The problem appears to be with setting gsnBoxMargin to 0.0.
> This is causing an internal value of 1.0 to be calculated for vpWidthF and
> 0.0 for vpXF which NCL doesn't like for this particular case.
>
> Is there a reason you need the plot to be as big as possible? Until we get a fix for this,
> we might be able to provide you with a work-around if I know what you need to do with
> the image.
>
> For example, I've had good results with making an image larger and trimming all white space
> by using ImageMagick's "convert" utility, along with "-trim" to remove white space, and
> "-geometry" to increase the geometry.
>
> --Mary
>
> On Jun 7, 2010, at 9:35 AM, Mary Haley wrote:
>
>
>> Hi Caroline,
>>
>> This sounds like a possible memory problem.
>>
>> I would like to be able to run your script here .
>>
>> Can you set:
>>
>> res@gsnDebugWriteFileName = "serraud"
>>
>> and rerun your script? This will create "serraud.nc", "serraud.ncl" and "serraud.res".
>> If you can then email me serraud.nc and serraud.ncl I can run it here. I don't need the *.res file.
>>
>> If the data file is too big (> 10 Mb), let me know.
>>
>> Thanks,
>>
>> --Mary
>>
>>
>>
>>
>> On Jun 7, 2010, at 9:03 AM, Caroline Serraud wrote:
>>
>>
>>> Hello everyone,
>>>
>>> I am facing some trouble to plot contour of 2m-temperature from GFS data downloaded from NCEP FTP site (for example, gfs.t18z.pgrb2f06)
>>> NCL crashes when I run my script with default contour fill mode (area fill mode) but is ok with RasterFill mode.
>>>
>>> But with a 0,5? resolution I would really appreciate area mode because raster mode is not that pretty (see example attached)
>>> Did someone already experience plotting filled contour for 2m-temperature from GFS?
>>>
>>> Caroline
>>>
>>> --
>>> Caroline Serraud - Ing?nieur Etudes & D?veloppements
>>> ------------------------------------------------------
>>> METEO CONSULT / La Chaine M?t?o - Groupe Figaro
>>> D?partement Informatique
>>> Domaine de Marsinval F-78540 Vernouillet, FRANCE
>>> T?l : 01 39 28 1990 - Fax : 01 39 71 85 31
>>> e-mail : cs@meteoconsult.fr
>>> ------------------------------------------------------
>>> Toute la m?t?o sur le Web : http://www.meteoconsult.fr
>>> Toute la m?t?o par t?l?phone : 3201
>>> ;*************************************************
>>> ; tempe_gfs.ncl
>>> ;************************************************
>>> 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
>>> if (.not.isvar("v_file")) then
>>> print("Le nom du fichier source n'est pas defini")
>>> exit()
>>> end if
>>> ;************************************************
>>> ; read in netCDF file
>>> ;************************************************
>>> a = addfile(v_file,"r")
>>> ;************************************************
>>> ; read in zonal [u] and meridional [v] winds
>>> ;************************************************
>>> t = a->TMP_P0_L103_GLL0(:,:)
>>> t = t - 273.15
>>> delete(t@units)
>>> delete(t@long_name)
>>>
>>>
>>> i_lat_min = v_lat_min + 0
>>> i_lat_max = v_lat_max + 0
>>> i_lon_min = v_lon_min + 0
>>> i_lon_max = v_lon_max + 0
>>>
>>> ;************************************************
>>> ; create plot
>>> ;************************************************
>>> wks_type = "ps"
>>> wks =gsn_open_wks(wks_type,"tempe")
>>>
>>> gsn_define_colormap(wks,"BlWhRe") ; choose color map
>>>
>>> res = True ; plot mods desired
>>> res@gsnMaximize = True
>>> res@gsnPaperOrientation = "landscape"
>>> res@gsnBoxMargin = 0.0
>>> res@gsnAddCyclic = False ; regional data
>>>
>>> res@lbLabelBarOn = False
>>>
>>> res@tmXBOn = False ; don't draw axis nor axis labels
>>> res@tmXTOn = False
>>> res@tmYLOn = False
>>> res@tmYROn = False
>>>
>>> res@cnLevelSelectionMode = "ManualLevels"
>>> res@cnMinLevelValF = -15.
>>> res@cnMaxLevelValF = 35.
>>> res@cnLevelSpacingF = 1.
>>> res@cnFillOn = True ; turn on color for contours
>>> res@cnLinesOn = False ; turn off contour lines
>>> res@cnLineLabelsOn = False ; turn off contour line labels
>>> res@cnFillColors = ispan(2,102,2)
>>> res@cnInfoLabelOn = False
>>> ; res@cnFillMode = "RasterFill"
>>>
>>> ; zoom in on map
>>>
>>> res@mpDataBaseVersion = "RANGS_GSHHS" ; high resolution coastline
>>> res@mpDataResolution = "FinestResolution"
>>> res@mpFillOn = False
>>> res@mpOutlineOn = False
>>> res@mpPerimOn = False
>>>
>>>
>>> res@mpProjection = "mercator"
>>> res@mpLimitMode = "Corners"
>>> res@mpLeftCornerLatF = i_lat_min
>>> res@mpLeftCornerLonF = i_lon_min
>>> res@mpRightCornerLatF = i_lat_max
>>> res@mpRightCornerLonF = i_lon_max
>>>
>>>
>>> plot=gsn_csm_contour_map(wks,t,res)
>>>
>>> end
>>>
>>>
>>> <1_tmp2m_2010060709.png>_______________________________________________
>>> 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
>>
>
>
>
>

--
Caroline Serraud - Ing?nieur Etudes & D?veloppements
------------------------------------------------------
METEO CONSULT / La Chaine M?t?o - Groupe Figaro
D?partement Informatique
Domaine de Marsinval F-78540 Vernouillet, FRANCE
T?l : 01 39 28 1990 - Fax : 01 39 71 85 31
e-mail : cs@meteoconsult.fr
------------------------------------------------------
Toute la m?t?o sur le Web : http://www.meteoconsult.fr
Toute la m?t?o par t?l?phone : 3201
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20100610/36281863/attachment.html
------------------------------
Message: 9
Date: Thu, 10 Jun 2010 15:53:56 +0530
From: Sahidul <sahidul@gmail.com>
Subject: Precipitation Rate Calculation
To: ncl-talk <ncl-talk@ucar.edu>
Message-ID:
        <AANLkTimajgJMkA0lC6NnmJgNCqwR7VR74rAl-V7_P3Ou@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Dear help,
I am having wrf forecast  files saved in 1 hour interval. So I am having
72  files in total. like below
wrfout_d02_2010-06-10_00:00:00
wrfout_d02_2010-06-10_01:00:00
wrfout_d02_2010-06-10_02:00:00
.....
etc.
I would like to calculate accumulated rainfall (RAINC + RAINNC) for every
hourly i.e., for 1st hour, 2nd hour, 3rd hour etc. till 72th hour rainfall.
I mean accumulated rainfall in every hour. So to calculate,  2nd hour
rainfall, I need to substract previous hour(i.e., 1st hour). In the same
way, to calculate 5th hour rainfall, I need to substract 4th hour rainfall.
etc etc.
Following script, I wrote which is reading every wrfout files and plotting
individually. I am not able to substract previous hour rainfall.  Could you
please help to solve it by modifying my script.
- - - - - -------- --- --- --- --- ----
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
datadir = "/casvol5/basantas/cas/WRF3-1/output-wrf/2010053000/"
FILES = systemfunc ("ls -1 " + datadir + "wrfout_d02* " )
numFILES = dimsizes(FILES)
do ifil = 0,numFILES-1
   a = addfile(FILES(ifil)+".nc","r")
; Set some basic resources
  res = True
;  res@MainTitle = "REAL-TIME WRF"
  res@InitTime = False
  res@Footer = False
  pltres = True
  mpres = True
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; What times and how many time steps are in the data set?
  FirstTime = True
  times  = wrf_user_list_times(a)  ; get times in the file
  ntimes = dimsizes(times)         ; number of times in the file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  do it = 0,ntimes-1,2             ; TIME LOOP
    print("Working on time: " + times(it) )
    if (FirstTime) then            ; Save some times for tracking tendencies
      times_sav = times(it)
    end if
;    res@TimeLabel = times(it)   ; Set Valid time to use on plots
day = systemfunc("echo "+times(it) +"|cut -c9-10")
yr =  systemfunc("echo "+times(it) +"|cut -c1-4")
mon = systemfunc("date '+%b'|tr [a-z] [A-Z]")
hr = systemfunc("echo "+times(it) +"|cut -c12-13")
; wks = gsn_open_wks(type,"rainhr")
 wks = gsn_open_wks("ps","rainhr_"+day+mon+yr+"_"+hr+"Z")
  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)
;gsn_define_colormap(wks,"gui_default")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need
  ; Get non-convective, convective and total precipitation
    rain_exp = wrf_user_getvar(a,"RAINNC",it)
    rain_con = wrf_user_getvar(a,"RAINC",it)
    rain_tot = rain_exp + rain_con
;    rain_tot@description = "Precipitation Rate"
    rain_tot@description = ""
;    rain_tot@units = "mm/hr"
        opts = res
        opts@cnFillOn = True
        opts@mpOutlineBoundarySets  = "AllBoundaries"
        mpres@mpOutlineBoundarySets  = "National"
        mpres@mpNationalLineThicknessF = 1.5
        mpres@mpNationalLineColor = "Black"
        mpres@mpGeophysicalLineColor = "Black"
        mpres@mpGeophysicalLineThicknessF = 1.5
; set resource for color of contour
;;;       opts@cnLevelSelectionMode = "ManualLevels"
;;;       opts@cnMinLevelValF       = 0.
;;;       opts@cnMaxLevelValF       = 30.
;;;       opts@cnLevelSpacingF      = 2.
;;;       opts@cnFillOn             = True
  opts@cnLevelSelectionMode  = "ExplicitLevels" ; explicit [unequal] cn
levels
  opts@cnLevels              = (/0,0.1,1,2.5,5,7.5,10,15,20,25,37.5,50/)
  ;;opts@cnLevels              =
(/0,0.1,1,2.5,5,7.5,10,15,20,25,37.5,50,75,100,125,150/)
  opts@cnFillOn              = True
  opts@cnFillMode            = "AreaFill"
;  opts@lbOrientation         = "Vertical"       ; default is horizontal
      ; Total Precipitation (color fill)
        contour_tot = wrf_contour(a,wks,rain_tot,opts)
  ; MAKE PLOTS
        ; Total Precipitation
          plot = wrf_map_overlays(a,wks,contour_tot,pltres,mpres)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    end do        ; END OF TIME LOOP
  end do        ; END OF TIME LOOP
end
- - - - - -------- --- --- --- --- ----
Thanking you,
with regards,'
Sahidull
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20100610/c59c41c3/attachment.html
------------------------------
Message: 10
Date: Thu, 10 Jun 2010 16:49:04 +0000
From: "Li, Yongzuo" <yongzuo.li@ou.edu>
Subject: XY plot
To: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
Message-ID:
        <3D70D3147AC59C42A3C346D8F9FA2A0A29958104@it-monad.sooner.net.ou.edu>
Content-Type: text/plain; charset="iso-8859-1"
Hi,
I use
ftp://ftp.caps.ou.edu/users/yli/sawtooth/hybrid-innov-sawtooth.ncl
to make
ftp://ftp.caps.ou.edu/users/yli/sawtooth/sawtooth.pdf
How can the X axis start at -0.5 exactly as defined?
Thanks.
Yongzuo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20100610/15684b66/attachment.html
------------------------------
Message: 11
Date: Thu, 10 Jun 2010 11:00:47 -0600
From: Adam Phillips <asphilli@ucar.edu>
Subject: Re: XY plot
To: ncl-talk@ucar.edu
Message-ID: <4C111A3F.6000304@ucar.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi Yongzuo,
Set trXMinF - -0.5
http://www.ncl.ucar.edu/Document/Graphics/Resources/tr.shtml#trXMinF
Also see example #1 here:
http://www.ncl.ucar.edu/Applications/tickmarks.shtml#ex1
Adam
On 06/10/2010 10:49 AM, Li, Yongzuo wrote:
> Hi,
>
> I use
>
> ftp://ftp.caps.ou.edu/users/yli/sawtooth/hybrid-innov-sawtooth.ncl
>
> to make
>
> ftp://ftp.caps.ou.edu/users/yli/sawtooth/sawtooth.pdf
>
> How can the X axis start at -0.5 exactly as defined?
>
> Thanks.
>
> Yongzuo
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
--
__________________________________________________
Adam Phillips
asphilli@ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
Climate and Global Dynamics Division         fax: (303) 497-1333
P.O. Box 3000
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
------------------------------
Message: 12
Date: Thu, 10 Jun 2010 11:57:13 -0600
From: David Brown <dbrown@ucar.edu>
Subject: Re: Contouring temperature with GFS dataset.
To: Caroline Serraud <cs@meteoconsult.fr>
Cc: ncl-talk NCL <ncl-talk@ucar.edu>
Message-ID: <4D659DB4-5658-4898-8BAB-1A28982F5A41@ucar.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes
Hi Caroline,
Another workaround might be to use RasterFill but set
cnRasterSmoothingOn to True. That will result in a plot that in most
cases is hard to distinguish from an AreaFill plot.
  -dave
On Jun 10, 2010, at 9:43 AM, Mary Haley wrote:
> Caroline,
>
> The problem appears to be with setting gsnBoxMargin to 0.0.
> This is causing an internal value of 1.0 to be calculated for
> vpWidthF and
> 0.0 for vpXF which NCL doesn't like for this particular case.
>
> Is there a reason you need the plot to be as big as possible? Until
> we get a fix for this,
> we might be able to provide you with a work-around if I know what
> you need to do with
> the image.
>
> For example, I've had good results with making an image larger and
> trimming all white space
> by using ImageMagick's "convert" utility, along with "-trim" to
> remove white space, and
> "-geometry" to increase the geometry.
>
> --Mary
>
> On Jun 7, 2010, at 9:35 AM, Mary Haley wrote:
>
>> Hi Caroline,
>>
>> This sounds like a possible memory problem.
>>
>> I would like to be able to run your script here .
>>
>> Can you set:
>>
>>  res@gsnDebugWriteFileName = "serraud"
>>
>> and rerun your script? This will create "serraud.nc", "serraud.ncl"
>> and "serraud.res".
>> If you can then email me serraud.nc and serraud.ncl I can run it
>> here. I don't need the *.res file.
>>
>> If the data file is too big (> 10 Mb), let me know.
>>
>> Thanks,
>>
>> --Mary
>>
>>
>>
>>
>> On Jun 7, 2010, at 9:03 AM, Caroline Serraud wrote:
>>
>>> Hello everyone,
>>>
>>> I am facing some trouble to plot contour of 2m-temperature from
>>> GFS data downloaded from NCEP FTP site (for example,
>>> gfs.t18z.pgrb2f06)
>>> NCL crashes when I run my script with default contour fill mode
>>> (area fill mode) but is ok with RasterFill mode.
>>>
>>> But with a 0,5? resolution I would really appreciate area mode
>>> because raster mode is not that pretty (see example attached)
>>> Did someone already experience plotting filled contour for 2m-
>>> temperature from GFS?
>>>
>>> Caroline
>>>
>>> --
>>> Caroline Serraud - Ing?nieur Etudes & D?veloppements
>>> ------------------------------------------------------
>>> METEO CONSULT / La Chaine M?t?o - Groupe Figaro
>>> D?partement Informatique
>>> Domaine de Marsinval F-78540 Vernouillet, FRANCE
>>> T?l : 01 39 28 1990 - Fax : 01 39 71 85 31
>>> e-mail : cs@meteoconsult.fr
>>> ------------------------------------------------------
>>> Toute la m?t?o sur le Web : http://www.meteoconsult.fr
>>> Toute la m?t?o par t?l?phone : 3201
>>> ;*************************************************
>>> ; tempe_gfs.ncl
>>> ;************************************************
>>> 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
>>> if (.not.isvar("v_file")) then
>>>      print("Le nom du fichier source n'est pas defini")
>>>      exit()
>>> end if
>>> ;************************************************
>>> ; read in netCDF file
>>> ;************************************************
>>> a = addfile(v_file,"r")
>>> ;************************************************
>>> ; read in zonal [u] and meridional [v] winds
>>> ;************************************************
>>> t = a->TMP_P0_L103_GLL0(:,:)
>>> t = t - 273.15
>>> delete(t@units)
>>> delete(t@long_name)
>>>
>>>
>>>  i_lat_min = v_lat_min + 0
>>>  i_lat_max = v_lat_max + 0
>>>  i_lon_min = v_lon_min + 0
>>>  i_lon_max = v_lon_max + 0
>>>
>>> ;************************************************
>>> ; create plot
>>> ;************************************************
>>> wks_type = "ps"
>>> wks =gsn_open_wks(wks_type,"tempe")
>>>
>>>     gsn_define_colormap(wks,"BlWhRe")     ; choose color map
>>>
>>>      res                         = True               ; plot mods
>>> desired
>>>     res@gsnMaximize = True
>>>     res@gsnPaperOrientation = "landscape"
>>>     res@gsnBoxMargin = 0.0
>>>     res@gsnAddCyclic            = False              ; regional data
>>>
>>>     res@lbLabelBarOn       = False
>>>
>>>     res@tmXBOn     = False            ; don't draw axis nor axis labels
>>>     res@tmXTOn     = False
>>>     res@tmYLOn     = False
>>>     res@tmYROn     = False
>>>
>>>     res@cnLevelSelectionMode = "ManualLevels"
>>>     res@cnMinLevelValF       = -15.
>>>     res@cnMaxLevelValF       = 35.
>>>     res@cnLevelSpacingF      = 1.
>>>     res@cnFillOn             = True               ; turn on color for
>>> contours
>>>     res@cnLinesOn            = False              ; turn off contour
>>> lines
>>>     res@cnLineLabelsOn       = False              ; turn off contour
>>> line labels
>>>     res@cnFillColors = ispan(2,102,2)
>>>     res@cnInfoLabelOn     = False
>>> ;   res@cnFillMode          = "RasterFill"
>>>
>>> ; zoom in on map
>>>
>>> res@mpDataBaseVersion       = "RANGS_GSHHS"       ; high
>>> resolution coastline
>>> res@mpDataResolution = "FinestResolution"
>>> res@mpFillOn                       = False
>>> res@mpOutlineOn            = False
>>> res@mpPerimOn               = False
>>>
>>>
>>> res@mpProjection           = "mercator"
>>> res@mpLimitMode                     = "Corners"
>>> res@mpLeftCornerLatF                = i_lat_min
>>> res@mpLeftCornerLonF                = i_lon_min
>>> res@mpRightCornerLatF               = i_lat_max
>>> res@mpRightCornerLonF               = i_lon_max
>>>
>>>
>>> plot=gsn_csm_contour_map(wks,t,res)
>>>
>>> end
>>>
>>>
>>> <
>>> 1_tmp2m_2010060709
>>> .png>_______________________________________________
>>> 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
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
------------------------------
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
End of ncl-talk Digest, Vol 79, Issue 22
****************************************
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 11 00:04:42 2010

This archive was generated by hypermail 2.1.8 : Fri Jun 11 2010 - 09:33:23 MDT