Re: can a procedure in NCL receive variables from another NCL script?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Dec 04 2013 - 23:05:47 MST

This thread has gone on for a long time.

--
The error message is telling you the issue
dv_nmm = out(1)" (line 97)
---
How big is the variable? Since it is referenced as out(1),
the variable must be of size two,
Think
     out = new (2, ...)
NCL has 0-based subscripting, so legal references are
     out(0) and out(1)
If variable 'out' is a scalar (a variable of size 1)
then out(1) is illegal.
On 12/4/13, 10:26 PM, Yi-Chih Huang wrote:
> Hello,
>
>      Thanks much for the replies.  I used function vShear_nmm to returns
> three variables.  In the function vShear_nmm the three variables seem to be
> fine from printVarSummary as follows.  But in the main NCL script the error
> message "Subscript out of range, error in subscript #0" showed up at
> "script dv_nmm = out(1)" (line 97).  Then how can I fix the error?
>
>      Many thanks,
>
>               Yi-Chih
>
> fatal:["NclMultiDVallistData.c":306]:MultiDVal_list_ReadSection: Subscript
> out of range, error in subscript #0
> fatal:An error occurred reading out
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 97 in file
> vShear.ncl
>
> ######
>    out = vShear_nmm ()
> printVarSummary(out)
>    du_nmm = out(0)
>    dv_nmm = out(1)
>    duy_nmm= out(2)
> printVarSummary(du_nmm)
> printVarSummary(dv_nmm)
> printVarSummary(duy_nmm)
>
> ######
> Variable: du_nmm
> Type: float
> Total Size: 321152 bytes
>              80288 values
> Number of Dimensions: 2
> Dimensions and sizes:   [lat | 193] x [lon | 416]
> Coordinates:
>              lat: [-30..30]
>              lon: [30.31246..159.9998]
> Number Of Attributes: 13
>    _FillValue :  1e+20
>    initial_time :        02/05/2006 (00:00)
>    model :       Climate Data Assimilation System (CDAS)
>    parameter_number :    33
>    parameter_table_version :     2
>    gds_grid_type :       0
>    level_indicator :     100
>    units :       m/s
>    long_name :   u-component of wind
>    center :      US National Weather Service - NCEP (WMC)
>    lv_ISBL1 :    850
>    average_op_ncl :      dim_avg_n over dimension(s): year
>    DataFreq :    Monthly
>
> Variable: dv_nmm
> Type: float
> Total Size: 321152 bytes
>              80288 values
> Number of Dimensions: 2
> Dimensions and sizes:   [lat | 193] x [lon | 416]
> Coordinates:
>              lat: [-30..30]
>              lon: [30.31246..159.9998]
> Number Of Attributes: 13
>    _FillValue :  1e+20
>    initial_time :        02/05/2006 (00:00)
>    model :       Climate Data Assimilation System (CDAS)
>    parameter_number :    34
>    parameter_table_version :     2
>    gds_grid_type :       0
>    level_indicator :     100
>    units :       m/s
>    long_name :   v-component of wind
>    center :      US National Weather Service - NCEP (WMC)
>    lv_ISBL1 :    850
>    average_op_ncl :      dim_avg_n over dimension(s): year
>    DataFreq :    Monthly
>
> Variable: duy_nmm
> Type: float
> Total Size: 772 bytes
>              193 values
> Number of Dimensions: 1
> Dimensions and sizes:   [lat | 193]
> Coordinates:
>              lat: [-30..30]
> Number Of Attributes: 13
>    DataFreq :    Monthly
>    average_op_ncl :      dim_avg_n over dimension(s): lon
>    lv_ISBL1 :    850
>    center :      US National Weather Service - NCEP (WMC)
>    long_name :   u-component of wind
>    units :       m/s
>    level_indicator :     100
>    gds_grid_type :       0
>    parameter_table_version :     2
>    parameter_number :    33
>    model :       Climate Data Assimilation System (CDAS)
>    initial_time :        02/05/2006 (00:00)
>    _FillValue :  1e+20
>
> Variable: lat
> Type: float
> Total Size: 772 bytes
>              193 values
> Number of Dimensions: 1
> Dimensions and sizes:   [lat | 193]
> Coordinates:
>              lat: [30..-30]
> Number Of Attributes: 9
>    La1 : 90
>    Lo1 :  0
>    La2 : -90
>    Lo2 : -0.313
>    Di :  0.3124996
>    Dj :  0.3125
>    units :       degrees_north
>    GridType :    Cylindrical Equidistant Projection Grid
>    long_name :   latitude
> (0)     a
> (0)     b
>
> Variable: out
> Type: list <concat | fifo>
> Total items: 3
>
> fatal:["NclMultiDVallistData.c":306]:MultiDVal_list_ReadSection: Subscript
> out of range, error in subscript #0
> fatal:An error occurred reading out
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 97 in file
> vShear.ncl
>
>
>
> On Thu, Dec 5, 2013 at 12:32 PM, Dave Allured - NOAA Affiliate <
> dave.allured@noaa.gov> wrote:
>
>> Rick et al,
>>
>> I just ran my demo with disparate data types within the same list.  It
>> works fine.
>>
>> --Dave
>>
>> On Wed, Dec 4, 2013 at 8:12 PM, <brownrig@ucar.edu> wrote:
>>>
>>> ... possibly the use of NCL's list-type in a function to return a
>>
>>> 3-element list of what you want. Caveat: I think the list type can
>>> hold elements of disparate type, but I'm not certain offhand. If not,
>>> this won't work.
>>
>>
>> _______________________________________________
>> 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 Dec 4 23:05:57 2013

This archive was generated by hypermail 2.1.8 : Fri Dec 13 2013 - 11:39:30 MST