Re: Coordinate subscript type mismatch.

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 10 2012 - 11:15:41 MDT

I think the problem is that you initially create the variable 'pre_MIPAS' as a double with the statement:

 pre_MIPAS = plev_MIPAS(ipressure)

In NCL once a variable has been created its type cannot be changed, so the next statement:

pre_MIPAS = dble2flt(plev_MIPAS(ipressure))

does indeed create a float value on the right side of the assignment, but then it is converted using normal type coercion back into a double for
assignment to a pre-existing double variable. (See http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclDataTypes.shtml#Coercion.)

The cure, I think, is simply to eliminate the first statement:

pre_MIPAS = plev_MIPAS(ipressure)

so that you are creating 'pre_MIPAS' as a float in the first place.
 -dave

On Oct 10, 2012, at 10:30 AM, Mary Haley wrote:

> Hongyan,
>
> I don't think I've see this type of error before, so I don't fully understand it. (Dave, can you help out here?)
>
> Line 168 is
>
>> 168 nox_modelEY_ave_40_60NS(ipressure) = avg(vNOx({pre_MIPAS},{40:60},:))
>
> I need to see what those variables look like:
>
> printVarSummary(nox_modelEY_ave_40_60NS)
> printVarSummary(vNOx)
>
> My feeling is that there's an issue with the way you are subscripting vNOx, so
> I need to see what its coordinate arrays look like.
>
> --Mary
>
> On Oct 8, 2012, at 8:37 PM, H.Dang wrote:
>
>> Dear all,
>>
>> I got the following error information in my NCL code:
>>
>> fatal:Coordinate subscript type mismatch. Subscript (0) can not be coerced to type of coordinate variable
>> fatal:["Execute.c":7556]:Execute: Error occurred at or near line 168 in file obs_mdl.ncl
>>
>>
>> 161 do ipressure = 0,28 - 1
>> 162 pre_MIPAS = plev_MIPAS(ipressure)
>> 163 pre_MIPAS = dble2flt(plev_MIPAS(ipressure))
>> 164
>> 165 printVarSummary(pre_MIPAS)
>> 166 printVarSummary(ple40)
>> 167 ;
>> 168 nox_modelEY_ave_40_60NS(ipressure) = avg(vNOx({pre_MIPAS},{40:60},:))
>> 179 end do
>>
>> The summary of the variables are:
>>
>> Variable: pre_MIPAS
>> Type: double
>> Total Size: 8 bytes
>> 1 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [1]
>> Coordinates:
>> Number Of Attributes: 7
>> typeConversion_op_ncl : double converted to float
>> units : hPa
>> long_name : pressure
>> axis : Z
>> positive : down
>> standard_name : air_pressure
>> plev : 300
>>
>> Variable: ple40
>> Type: float
>> Total Size: 160 bytes
>> 40 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [ple | 40]
>> Coordinates:
>> ple: [964..0.1]
>> Number Of Attributes: 1
>> units : mb
>>
>> I though the error is caused by the variable type, but when I used "dble2flt" to convert the type from double to float, the error message is till the same. So is my idea of converting correct or not? How should I fix this problem? Thank you!
>>
>> Hongyan
>>
>> _______________________________________________
>> 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
Received on Wed Oct 10 11:15:48 2012

This archive was generated by hypermail 2.1.8 : Fri Oct 12 2012 - 15:38:19 MDT