RE: [ncl-talk] Vinth2p_ecmwf errors

From: Tummuri, Spandana <spandana.tummuri_at_nyahnyahspammersnyahnyah>
Date: Fri, 8 Jun 2007 23:04:55 -0500

Hello Dennis,
 
Thanks a lot for the reply. I am currently running version 4.2.0.a033. I checked on the ESG website and it looks like 4.3.0 is the latest version available.
 
Is tbot required as two dimensional for 4.2.0.a033 version? Should I download the latest one to make my program work?
 
Thanks.
Spandana Tummuri
 
Research Assistant,
Texas Tech University,
2717, 3rd St. # 315
Lubbock, Texas-79415
806-741-0901 (Home)
806-470-7732 (Cell).

________________________________

From: Dennis Shea [mailto:shea_at_ucar.edu]
Sent: Fri 6/8/2007 10:12 AM
To: Tummuri, Spandana
Cc: ncl-talk_at_ucar.edu
Subject: Re: Vinth2p_ecmwf errors

Hello,

What version of NCL are you using?

Earlier versions required "tbot" to be two dimensional.
This was changed some time ago.

D

Tummuri, Spandana wrote:
>
> Hello,
>
> I am trying to convert CCSM 3.0 output variables to different pressure levels using the vinth2p_ecmwf command. I have attached the program (CCSM_2_MM5_levs.ncl) that I am using to carry out the conversion. I get the following errors while trying to run the program.
>
> When I set tbot = t(:,nlev-1,:,:), It gives me the following error.
>
> "fatal:Number of subscripts on rhs do not match number of dimensions of
> variable,(4) Subscripts used, (3) Subscripts expected
> fatal:Execute: Error occurred at or near line 59 in file
> CCSM_2_MM5_levs.ncl"
>
>
> If I remove the last semi colon ( I know I should not but I just tried)
> and use tbot = t(:,nlev-1,:) it does not give me the previous error but instead gives the following error.
>
> "fatal:vinth2p_ecmwf: Surface pressure must have same number of time, lat
> and lon elements as input, number of dimensions does not match.
> fatal:Execute: Error occurred at or near line 75 in file
> CCSM_2_MM5_levs.ncl"
>
> The line where the error is occurring is this
>
> lev_array(i,:,:,:,:) = vinth2p_ecmwf(var,hyam,hybm,pnew,PS,interp(i),P0,1,True,varflg(i),tbot,PHIS)
>
> I am using a program that someone else has written and when I checked with them, they informed me that they did not get this error.
>
> I printed the variable summary using the printVarSummary command and I obtained the following output:
>
> Variable: t
> Type: float
> Total Size: 15859712 bytes
> 3964928 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 121] x [lat | 128] x [lon | 256]
> Coordinates:
> time: [54750..54780]
> lat: [-88.9277353522959..88.9277353522959]
> lon: [ 0..358.59375]
> Number Of Attributes: 2
> units : K
> long_name : Surface temperature (radiative)
>
> Variable: tbot
> Type: float
> Total Size: 15859712 bytes
> 3964928 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 121] x [lat | 128] x [lon | 256]
> Coordinates:
> time: [54750..54780]
> lat: [-88.9277353522959..88.9277353522959]
> lon: [ 0..358.59375]
> Number Of Attributes: 2
> long_name : Surface temperature (radiative)
> units : K
>
> Variable: PS
> Type: float
> Total Size: 15859712 bytes
> 3964928 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 121] x [lat | 128] x [lon | 256]
> Coordinates:
> time: [54750..54780]
> lat: [-88.9277353522959..88.9277353522959]
> lon: [ 0..358.59375]
> Number Of Attributes: 2
> units : Pa
> long_name : Surface pressure
>
> Variable: PHIS
> Type: float
> Total Size: 15859712 bytes
> 3964928 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 121] x [lat | 128] x [lon | 256]
> Coordinates:
> time: [54750..54780]
> lat: [-88.9277353522959..88.9277353522959]
> lon: [ 0..358.59375]
> Number Of Attributes: 2
> units : m2/s2
> long_name : Surface geopotential
>
>
> I am not very familiar with NCL programming language and hence am not able to figure out why I am getting the above mentioned errors.
>
> Can anyone please help me figure out the solution?
>
> Thanks in advance.
>
> Spandana Tummuri
>
>
>
> Research Assistant,
> Texas Tech University,
> 2717, 3rd St. # 315
> Lubbock, Texas-79415
> 806-741-0901 (Home)
> 806-470-7732 (Cell).
>
> ------------------------------------------------------------------------
>
> ;************************************************
> ; CSM_2_MM5_levs_fortran_b056.11N_7.ncl
> ;************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> external SUBS "/home/stummuri/files/test3.so"
> ;************************************************
> begin
> ;************************************************
> ; file handling
> ;************************************************
> fn3 ="/home/stummuri/CCSM-INPUTS/PHIS-1.nc" ; define filename
> in3 = addfile(fn3,"r") ; open netcdf file
>
>
> fn2 ="/home/stummuri/CCSM-INPUTS/PS-1.nc"
> in2 = addfile(fn2,"r")
>
> fn ="/home/stummuri/CCSM-INPUTS/TS-1.nc"
> in = addfile(fn,"r")
>
> ;************************************************
> ; read lat/lon and get their sizes
> ;************************************************
> lat = in->lat
> lon = in->lon
> time = in->time
> lev = in->lev
> t = in->TS
>
> nlat = dimsizes(lat)
> nlon = dimsizes(lon)
> ntime = dimsizes(time)
> nlev = dimsizes(lev)
>
> ;************************************************
> ; read needed variables required for vertical interpolation
> ;************************************************
> P0 = 1000. ; reference pressure (in mb for vinth2p)
> hyam = in->hyam ; get a coefficiants
> hybm = in->hybm ; get b coefficiants
> PS = in2->PS ; get surface pressuret
> PHIS = in3->PHIS(0,:,:) ; get surface GPH
>
> ;************************************************
> ; define input and output strings
> ;************************************************
>
> short_name = (/"TS"/)
>
> interp_var = (/"TS"/)
> interp = (/2/) ; 2=log,1=linear
> varflg = (/1/) ; Integer flag: =1 if the field being interpolated is temperature; =-1
> ; for geopotential height; =0 for any other variable
>
> ; get the lowest level temperature
> nlev = dimsizes(hyam)
>
> tbot =t(:,nlev-1,:,:)
> ;tbot =t(:,:,:)
>
> printVarSummary (t)
> printVarSummary (tbot)
> printVarSummary (PS)
> printVarSummary (PHIS)
>
> ;************************************************
> ; create pressure array to interpolate to
> ;************************************************
> pnew = (/5., 13., 33., 64., 100., 140., 190., 255., 330., \
> 415., 500., 600., 700., 800., 875., 940., 980., 1000./)
>
> nlev = dimsizes(hyam)
> ;************************************************
> ; interp to pressure levels
> ;************************************************
>
> lev_array = new((/dimsizes(interp_var),ntime,nlev,nlat,nlon/),float)
> do i = 0,dimsizes(interp_var)-1
> var = in->$interp_var(i)$
> lev_array(i,:,:,:,:) = vinth2p_ecmwf(var,hyam,hybm,pnew,PS,interp(i),P0,1,True,varflg(i),tbot,PHIS)
> end do
> ;************************************************
> ; output binary files
> ;************************************************
> datesec = in->datesec
> date = in->date
>
> pnew = pnew*100.
> ; asciiwrite("PNEW.lst", pnew)
>
>
> do j = 0, ntime-1
> do i = 0,dimsizes(interp_var)-1
> datesec1=datesec(j)
> date1=date(j)
> ; SUBS::test3(t(j,:,:,:),nlev,nlat,nlon)
> SUBS::test3(i+1,lev_array(i,j,:,:,:),pnew,lat,lon,datesec1,date1)
> end do
> end do
> end
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

--
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 08 2007 - 22:04:55 MDT

This archive was generated by hypermail 2.2.0 : Thu Jun 14 2007 - 09:39:54 MDT