RE: Argument type mismatch error

From: Tummuri, Spandana <spandana.tummuri_at_nyahnyahspammersnyahnyah>
Date: Thu, 14 Jun 2007 11:16:28 -0500

Dennis,
 
Using doubletofloat, I could get rid of the error.
 
Thanks for the help.
Spandana.
 
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: Tue 6/12/2007 3:53 PM
To: Tummuri, Spandana
Cc: ncl-talk_at_ucar.edu
Subject: Re: Argument type mismatch error

Hello,

the arguments on your fortran subroutine are: (n,x,p,lat,lon,ds,dt)

                                                                                  
0,1,2,3,4,5, 6 , 7, 8

Hence, it is the "lat" variable. I note from printVarSummary that
lat and lon look like they are double precision.

            lat: [-88.9277353522959..88.9277353522959]
            lon: [ 0..358.59375]

I speculate that your fortran code has these typed as real variable.

NCL will promote [integer=>float/double, float=>double] when calling
a fortran code because no information is lost. However, NCL is a strongly
typed language in the sense that it will not 'demote' unless a function
is explicitly used. So, I speculate that the lat from NCL is double
precision
but the lat in the fortran code is real. NCL will not automatically
demote double=>float.

So if you want lat [probably longitude] as single precision then

   (n,x,p,doubletofloat(lat),doubletpfloat(lon),ds,dt)

this goes for any variable.

Good luck
D

Tummuri, Spandana wrote:
> Hello Dennis,
>
> As per your suggetion, I downloaded NCL 4.3.0 and I could get rid of the error. Thanks a lot for all the help. My program gives me another error now and I am not sure why I am getting it.
>
> After interpolating the variables to different pressure levels, I am trying to write the output to binary files using the subroutine declared in output_levs2.so file (subroutine output_lev2 (n,x,p,lat,lon,ds,dt). Relavent section from the ncl code I am using is pasted below. When I run the ncl file, I get the following error.
>
> fatal:Argument type mismatch on argument (3) of (output_lev2) can not coerce
> fatal:Execute: Error occurred at or near line 112 in file CCSM_2_MM5_levs.ncl
>
> Line 112 is the line in bold letters in the code below. If you want me to send the fortran stub or the complete version of my ncl program, I can send it to you.
>
>
> ;************************************************
>
> ; 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(pnew)
>
> ; 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::output_lev2(t(j,:,:,:),nlev,nlat,nlon)
>
> SUBS::output_lev2(i+1,lev_array(i,j,:,:,:),pnew,lat,lon,datesec1,date1)
>
> end do
>
> end do
>
> end
>
>
>
> Thanks.
> Spandana.
> 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: Mon 6/11/2007 12:08 PM
> To: Tummuri, Spandana
> Subject: Re: Vinth2p_ecmwf errors
>
>
>
>
> FYI: the main person who created the interface is currently unavailable.
> I can not look at it.
>
> I do believe that 4.3.0 is needed.
>
> Regards
> D
>
>
>
>> From: Dennis Shea [mailto:shea_at_ucar.edu]
>> Sent: Mon 6/11/2007 10:53 AM
>> To: Tummuri, Spandana
>> Cc: ncl-talk_at_ucar.edu
>> Subject: Re: Vinth2p_ecmwf errors
>>
>>
>>
>> Tummuri, Spandana wrote:
>>
>>
>>> 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
>>>>
>>>>
>
>
>
>
>
>

--
======================================================
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 Thu Jun 14 2007 - 10:16:28 MDT

This archive was generated by hypermail 2.2.0 : Fri Jun 15 2007 - 12:34:56 MDT