How to call Fortran subfunction in NCL
In this issue, the editor will bring you about how to call the Fortran subfunction in NCL. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
1. Steps:
Note:
① stub declares the format of variables
② so files can be understood as a medium that NCL can read.
C NCLFORTSTART
Subroutine F1 (x, y, z)
Integer
Real
C NCLEND
Or:
C NCLFORTSTART
Function f2 (x, y, z)
Integer
Real
C NCLEND
③ abc is the "introduction" to the calling function, telling NCL that we are going to call Fortran
two。 Demonstration:
A) prepare the subfunction to be called in advance, write it in Fortran, and save it as ex01.F90:
B) write the variable declaration for the F90 file and save it as ex01.stub:
C) follow the steps, add the Fortran function call declaration and invoke the subfunction in the NCL script:
D) run:
① first generates the so file: WRAPIT ex01.stub ex01.f90
② runs ncl:ncl ex01.ncl
At first, y has no value, it is initialized by the new function, and finally output to the screen, you can see that the experiment is successful.
This is how to call the Fortran subfunction in the NCL shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.