[ncl-talk] Why the fortran routine (by WRAPIT) return the wrong value, even I did nothing with the returned variable?

Tao Lu hakufu.asano at gmail.com
Tue Jan 31 07:56:19 MST 2017


HI

I find sth here, http://www.ncl.ucar.edu/Document/Tools/WRAPIT.shtml

Array dimensioning

For NCL arrays, the fastest-varying dimension is the rightmost, while for
Fortran it is the leftmost dimension. Therefore, if XA is a Fortran array
dimensioned idim x jdim, this array will be dimensioned jdim x idim in NCL.
Also, Fortran array subscripts start at 1, whereas NCL array subscripts
start at 0.

I changed the dimension and it is okay now.

Thank you

On Tue, Jan 31, 2017 at 11:25 PM, Tao Lu <hakufu.asano at gmail.com> wrote:

> Hi:
>
> Yes, I still got segmentation fault.
>
> On Tue, Jan 31, 2017 at 11:11 PM, Barry Lynn <barry.h.lynn at gmail.com>
> wrote:
>
>> Hi:
>>
>> Do you get a segmentation fault when even if you don't have any code
>> below the NCLEND?
>>
>> On Tue, Jan 31, 2017 at 3:11 PM, Tao Lu <hakufu.asano at gmail.com> wrote:
>>
>>> Hi Barry
>>>
>>> Thank you for your advice.
>>>
>>> I tried a simpler one.
>>>
>>> What I tried:
>>> *C NCLFORTSTART*
>>> *      subroutine dobjanlx(grid,mlon,nlat)        *
>>> *      implicit none*
>>> *      integer   mlon,nlat*
>>> *      double precision  grid(nlat,mlon) *
>>> *C NCLEND*
>>>
>>> *        integer   ml,nl*
>>> *        do nl=1,nlat *
>>> *          do ml=1,mlon *
>>> *             grid(nl,ml) = 1.d0*
>>> *          end do*
>>> *        end do*
>>>
>>> *      return*
>>> *      end*
>>>
>>> I called like this
>>>     grid = new((/nlat,nlon/),double)
>>>     grid at _FillValue = -999
>>>     test::dobjanlx(grid,nlon,nlat)
>>>
>>>
>>> But I got "Segmentation fault"
>>>
>>> On Tue, Jan 31, 2017 at 8:36 PM, Barry Lynn <barry.h.lynn at gmail.com>
>>> wrote:
>>>
>>>> Hi Tao:
>>>>
>>>> Could you please provide more information.
>>>>
>>>> Have you checked that the variables you are passing to your routine are
>>>> non-zero?  Did you double check that the array values are being passed
>>>> correctly?
>>>>
>>>> When I had a similar problem, I passed just a few variables to start
>>>> and checked that they correct, including array bounds.
>>>>
>>>> Barry
>>>>
>>>> On Tue, Jan 31, 2017 at 1:29 PM, Tao Lu <hakufu.asano at gmail.com> wrote:
>>>>
>>>>> Hello ncl-talk
>>>>>
>>>>> I used a fortran subroutine by WRAPIT, but I even get value when I did
>>>>> nothing about the variable.
>>>>> Could you help see why?
>>>>>
>>>>> I attached the ncl script, fortran code and the output txt file.
>>>>>
>>>>>
>>>>> Thank you,
>>>>> Tao
>>>>> --
>>>>> ******************************************************
>>>>> 盧 涛 (ル タオ) 修士課程2年
>>>>>
>>>>> 〒112-8551 東京都文京区春日1-13-27
>>>>>
>>>>> 中央大学理工学研究科都市環境学専攻
>>>>>
>>>>> 河川・水文研究室(山田正教授)
>>>>>
>>>>>
>>>>> TEL: 03-3817-3406;   Phone: 070-2188-7509
>>>>> Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
>>>>> Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
>>>>> *******************************************************
>>>>> ******************************************************
>>>>> Tao Lu    (M. Eng)
>>>>> Laboratory of River Engineering and Hydrology,
>>>>> Dept. of Civil and Environmental Engineering,
>>>>> Graduate School of Science and Engineering,
>>>>> Chuo University
>>>>>
>>>>> 1-13-27,Kasuga,Bunkyo-ku,Tokyo
>>>>> 112-8551, Japan
>>>>> TEL: 03-3817-1805;   Phone: 070-2188-7509
>>>>> Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
>>>>> Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
>>>>> *****************************************************
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Barry H. Lynn, Ph.D
>>>> Senior Lecturer,
>>>> The Institute of the Earth Science,
>>>> The Hebrew University of Jerusalem,
>>>> Givat Ram, Jerusalem 91904, Israel
>>>> Tel: 972 547 231 170
>>>> Fax: (972)-25662581
>>>>
>>>> C.E.O, Weather It Is, LTD
>>>> Weather and Climate Focus
>>>> http://weather-it-is.com
>>>> Jerusalem, Israel
>>>> Local: 02 930 9525
>>>> Cell: 054 7 231 170
>>>> Int-IS: x972 2 930 9525
>>>> US 914 432 3108 <(914)%20432-3108>
>>>>
>>>
>>>
>>>
>>> --
>>> ******************************************************
>>> 盧 涛 (ル タオ) 修士課程2年
>>>
>>> 〒112-8551 東京都文京区春日1-13-27
>>>
>>> 中央大学理工学研究科都市環境学専攻
>>>
>>> 河川・水文研究室(山田正教授)
>>>
>>>
>>> TEL: 03-3817-3406;   Phone: 070-2188-7509
>>> Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
>>> Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
>>> *******************************************************
>>> ******************************************************
>>> Tao Lu    (M. Eng)
>>> Laboratory of River Engineering and Hydrology,
>>> Dept. of Civil and Environmental Engineering,
>>> Graduate School of Science and Engineering,
>>> Chuo University
>>>
>>> 1-13-27,Kasuga,Bunkyo-ku,Tokyo
>>> 112-8551, Japan
>>> TEL: 03-3817-1805;   Phone: 070-2188-7509
>>> Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
>>> Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
>>> *****************************************************
>>>
>>
>>
>>
>> --
>> Barry H. Lynn, Ph.D
>> Senior Lecturer,
>> The Institute of the Earth Science,
>> The Hebrew University of Jerusalem,
>> Givat Ram, Jerusalem 91904, Israel
>> Tel: 972 547 231 170
>> Fax: (972)-25662581
>>
>> C.E.O, Weather It Is, LTD
>> Weather and Climate Focus
>> http://weather-it-is.com
>> Jerusalem, Israel
>> Local: 02 930 9525
>> Cell: 054 7 231 170
>> Int-IS: x972 2 930 9525
>> US 914 432 3108 <(914)%20432-3108>
>>
>
>
>
> --
> ******************************************************
> 盧 涛 (ル タオ) 修士課程2年
>
> 〒112-8551 東京都文京区春日1-13-27
>
> 中央大学理工学研究科都市環境学専攻
>
> 河川・水文研究室(山田正教授)
>
>
> TEL: 03-3817-3406;   Phone: 070-2188-7509
> Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
> Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
> *******************************************************
> ******************************************************
> Tao Lu    (M. Eng)
> Laboratory of River Engineering and Hydrology,
> Dept. of Civil and Environmental Engineering,
> Graduate School of Science and Engineering,
> Chuo University
>
> 1-13-27,Kasuga,Bunkyo-ku,Tokyo
> 112-8551, Japan
> TEL: 03-3817-1805;   Phone: 070-2188-7509
> Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
> Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
> *****************************************************
>



-- 
******************************************************
盧 涛 (ル タオ) 修士課程2年

〒112-8551 東京都文京区春日1-13-27

中央大学理工学研究科都市環境学専攻

河川・水文研究室(山田正教授)


TEL: 03-3817-3406;   Phone: 070-2188-7509
Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
*******************************************************
******************************************************
Tao Lu    (M. Eng)
Laboratory of River Engineering and Hydrology,
Dept. of Civil and Environmental Engineering,
Graduate School of Science and Engineering,
Chuo University

1-13-27,Kasuga,Bunkyo-ku,Tokyo
112-8551, Japan
TEL: 03-3817-1805;   Phone: 070-2188-7509
Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
*****************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170131/1b9010f5/attachment.html 


More information about the ncl-talk mailing list