[ncl-install] array appending in PynGL

Mahesh Kovilakam mkmvarma at gmail.com
Fri Jun 7 10:05:44 MDT 2019


Hi,
I am now transitioning to python and I recently installed PynGL and now
converting one NCL script to python. I would like to concatenate two arrays
and in NCL it was easy using "array_append_record". For python, I used "
np.concatenate(array1,array2,axis=0)" but it gives me this error:

  File "MERGE_netcdf_test.py", line 86, in <module>

    merge_data = np.concatenate(ext_525_v11,ext_525_v2,axis=0)

TypeError: 'NioVariable' object cannot be interpreted as an integer

I am not sure what that means. Here are the two variables I am trying to
concatenate:

Variable: ext_525

Type: float

Total Size: 5253120 bytes

            1313280 values

Number of Dimensions: 4

Dimensions and sizes: [year | 38] x [month | 12] x [lat | 32] x [alt | 90]

Coordinates:

            year: [1979..2016]

            month: [1..12]

            lat: [-77.5..77.5]

            alt: [0.5..45]

Number of Attributes: 2

         _FillValue : -999

         mwv : 0.525


Variable: MERGED_EXT_525

Type: float

Total Size: 2350080 bytes

            587520 values

Number of Dimensions: 4

Dimensions and sizes: [year | 17] x [month | 12] x [lat | 32] x [alt | 90]

Coordinates:

            year: [2002..2018]

            month: [1..12]

            lat: [-77.5..77.5]

            alt: [0.5..45]

Number of Attributes: 6

         mwv : 0.525

         description : zonally averaged cloud cleared extinction at 525 nm

         average_op_ncl : dim_avg_n over dimension(s): profiles

         long_name : merged extinction from OSIRIS, CALIPSO, and
SAGEIII-ISS at 525 nm

         units : 1/km

         _FillValue : -999


I just want to append these two arrays so that the new variable will have
values from 1979 through 2018. In NCL, I just use
array_append_record(ext_525,merged_ext_525) which will produce an array
that goes from 1979 through 2018. I am not sure in python, the "np.append"
can be used.
And my apologies of posting this question in NCL talk. I don't know if I
could post this question to any other forum so posting it here.

Thanks,
Mahesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-install/attachments/20190607/cc231b49/attachment.html>


More information about the ncl-install mailing list