[ncl-talk] WRAPIT_input data change its value

Dennis Shea shea at ucar.edu
Fri Aug 12 13:49:45 MDT 2016


As noted in the documentation, NCL's WRAPIT

[1]
recognizes *only* f77 syntax. The fortran syntax parser used by NCL's
WRAPIT  was created before the f90 standard was created.
.
[2]
f90 files require a 'stub' file which uses f77 syntax to define the
variables being passed back-and-forrth.

===
See Attached

%> WRAPIT ChangLiu.stub ChangLiu.f90
%> ncl tst_WRPAIT.ChangLiu.ncl



Variable: day
Type: integer
Total Size: 16 bytes
            4 values
Number of Dimensions: 1
Dimensions and sizes:    [4]
Coordinates:
Number Of Attributes: 1
  _FillValue :    -999
(0)    1
(1)    2
(2)    3
(3)    4

          1           2           3           4
(0)    ======================
           1           2           3           4
           1           4           9          16
(0)    ======================





On Thu, Aug 11, 2016 at 8:08 PM, Chang Liu <changliu at uark.edu> wrote:

> Hi,
>
>
>
> I try to use WRAPIT to call a Fortran function, The problem is the input
> data change its value.
>
> For example ,input data: 1,2,3,4,5
>
> But when use it in the Fortran ,the value is 1103626240  1104150528
> 1104674816  1105199104  1105723392
>
>
>
> The code is very simple
>
>
>
> Ncl :
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
> external AWSSI "./awssi.so"
>
> f=addfile("/data/cliu/noram_v04_1960_2009.grid.nc","r")
>
> time= cd_calendar(f&time,0)
>
> day=time(:,2)
>
> print(day)                         ;output is 1,2,3,4
>
> AWSSI::awssi(day)
>
>
>
> Fortran 90:
>
> SUBROUTINE awssi(day)
>
> integer,intent(in) ::day(18263)
>
> print*,day                                            ;output is 1103626240
> 1104150528  1104674816  1105199104  1105723392
>
> end
>
>
>
> I don’t know what happens, could you give me some advices?
>
>
>
> Best,
>
> Chang
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160812/734c9b98/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tst_WRPAIT.ChangLiu.ncl
Type: text/x-ncl
Size: 535 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160812/734c9b98/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ChangLiu.stub
Type: application/octet-stream
Size: 168 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160812/734c9b98/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ChangLiu.f90
Type: text/x-fortran
Size: 283 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160812/734c9b98/attachment-0001.bin 


More information about the ncl-talk mailing list