Dear Moti,
Please check the time dimension of your input file
"wrfout_d01_2007-01-31_12.nc". The error occurs because the time dimension
in P is out of range. If the time dimension of your file 12 and you want to
extract 12th time step, you need to use p = f->P(11,0,:,:) because in NCL
dimension starts at zero.
Thanks
Debasish
-----Original Message-----
From: ncl-talk-bounces_at_ucar.edu [mailto:ncl-talk-bounces_at_ucar.edu] On Behalf
Of Mittal, Moti
Sent: Friday, March 27, 2009 10:15 AM
To: Adam Phillips
Cc: ncl-talk_at_ucar.edu
Subject: Re: (no subject)
Thank you for the advice.
I am now getting the error:
out of range, error in subscript #0
Following is the output.
[mmittal_at_localhost ~/NCL]$ ncl exam1
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.
fatal:Subscript out of range, error in subscript #0
fatal:Execute: Error occurred at or near line 22 in file exam1
Moti
Professor, Department of Environment and Occupational Health
College of Public Health
University of South Florida
13201 Bruce B. Downs Blvd., MDC56
Tampa, Fl 33612-3805
Tel: (813) 974-9571
Fax: (813) 974-4986
Email: mmittal_at_health.usf.edu
________________________________________
From: Adam Phillips [asphilli_at_cgd.ucar.edu]
Sent: Friday, March 27, 2009 1:56 PM
To: Mittal, Moti
Cc: ncl-talk_at_ucar.edu
Subject: Re: (no subject)
Hi Moti,
When running a NCL script, you should type:
ncl scriptname.ncl
Or in your case:
ncl exam1
If that doesn't fix your issue let us know.
Best regards,
Adam
Mittal, Moti wrote:
> I am a new user of NCL and is at the learning stage.
> I have installed ncl 5.1.0 successfully and have checked with ng4ex
gsun01n.
> I am trying to learn to use NCL for WRF output.
> I tried to use the following script:
>
> 1 ;********************************************************
> 2 ; WRF: simple plane view of the pressure field
> 3 ; at a specific time and level. No map background.
> 4 ;********************************************************
> 5 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> 6 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> 7 begin
> 8 ;********************************************************
> 9 ; open file
> 10 ;********************************************************
> 11 f = addfile ("wrfout_d01_2007-01-31_12.nc", "r")
> 12
> 13 ;********************************************************
> 14 ; Read character variable Times
> 15 ; Convert to type string for plotting purposes
> 16 ;********************************************************
> 17 times = chartostring(f->Times) ; built-in function
> 18
> 19 ;********************************************************
> 20 ; Read Pressure at Time=12, level=0, convert to hPa
> 21 ;********************************************************
> 22 p = f->P(12,0,:,:) ; import data + meta info
> 23 p = p*0.01 ; demo: convert to hPa
> 24 p_at_units = "hPa" ; update units attribute
> 25
> 26 ;********************************************************
> 27 ; create plots
> 28 ;********************************************************
> 29 wks = gsn_open_wks("ps" ,"WRF_cn") ; ps,pdf,x11,ncgm,eps
> 30 gsn_define_colormap(wks,"BlAqGrYeOrReVi200"); select color map
> 31
> 32 res = True ; plot mods desired
> 33 ;;res_at_gsnMaximize = True ; uncomment to maximize
> 34 size
> 35 res_at_tiMainString = times(12) ; main title
> 36 plot = gsn_csm_contour(wks,p,res)
> 37
> 38 res_at_cnFillOn = True ; turn on color
> 39 res_at_cnLinesOn = False ; turn contour lines
> 40 res_at_gsnSpreadColors = True ; use entire color map
> 41 res_at_lbLabelAutoStride = True ; let NCL determine
label
> 42 spacing
> 43 plot = gsn_csm_contour(wks,p,res)
> 44 end
> 45
>
> but I am getting the error
> [mmittal_at_localhost ~/NCL]$ ./exam1
> ./exam1: line 1: syntax error near unexpected token `;'
> ./exam1: line 1:
`;********************************************************'
>
> I am using cshell. Script is the file exam1 and does not have line
numbers.
>
> What am I missing?
>
> Thank you for your help.
>
> Moti Mittal
> Professor, Department of Environment and Occupational Health
> College of Public Health
> University of South Florida
> 13201 Bruce B. Downs Blvd., MDC56
> Tampa, Fl 33612-3805
>
> Tel: (813) 974-9571
> Fax: (813) 974-4986
> Email: mmittal_at_health.usf.edu
> ________________________________________
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- -------------------------------------------------------------- Adam Phillips asphilli_at_ucar.edu National Center for Atmospheric Research tel: (303) 497-1726 ESSL/CGD/CAS fax: (303) 497-1333 P.O. Box 3000 Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli _______________________________________________ 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-talkReceived on Fri Mar 27 2009 - 12:30:50 MDT
This archive was generated by hypermail 2.2.0 : Mon Apr 06 2009 - 10:23:30 MDT