Pyroms scrip Fortran runtime error: Bad FORM parameter in OPEN statement

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
carlosag
Posts: 24
Joined: Thu Sep 30, 2021 12:08 pm
Location: University of Iceland

Pyroms scrip Fortran runtime error: Bad FORM parameter in OPEN statement

#1 Unread post by carlosag »

Hello everybody,
hope you are doing fine.

I am constantly facing two problems with Pyroms https://github.com/ESMG/pyroms
I downloaded it and went through all the installation process in Ubuntu 20.04.
At some point in the installation instructions, a brief but clear description on scrip is given and it is suggested to compile it and then to copy the *.so file to a specific folder where it will be read.
Now, there are two main problems that I am facing.

In the file pyscrip.f90, line 138, there is the following line:

Code: Select all

 open(iunit, file=namelist_file, status='old', form='formatted')


and when I do make the makefile all goes nice and smooth. The execution though fails with this error:
$ python3.7 make_remap_weights_file.py

Assuming spherical is integer b'T' <class 'numpy.ma.core.MaskedArray'>
Load geographical grid from file
grid shape2 40 20
grid shape2 40 19
grid shape2 39 20
At line 138 of file ./pyscrip.f90 (unit = 1)
Fortran runtime error: Bad FORM parameter in OPEN statement
If I try to execute this command

Code: Select all

$ python3.7 make_remap_weights_file.py 
again and again, I might get the same error or a different one:
Assuming spherical is integer b'T' <class 'numpy.ma.core.MaskedArray'>
Load geographical grid from file
grid shape2 40 20
grid shape2 40 19
grid shape2 39 20
Segmentation fault (core dumped)
I am completely lost. In that particular line, 138, a file name compute_remap_weights_in that contains the following:

Code: Select all

 &remap_inputs
    num_maps = 1
    grid1_file = 'remap_grid_GLBy0.08_NEP_t.nc'
    grid2_file = 'remap_grid_SOMELARGENAMEEE_rho.nc'
    interp_file1 = 'remap_weights_GLBy0.08_to_SOMELARGENAMEEE_bilinear_t_to_rho.nc'
    interp_file2 = 'remap_weights_SOMELARGENAMEEE_to_GLBy0.08_bilinear_rho_to_t.nc'
    map1_name = 'GLBy0.08 to SOMELARGENAMEEE Bilinear Mapping'
    map2_name = 'SOMELARGENAMEEE to GLBy0.08 Bilinear Mapping'
    map_method = 'bilinear'
    normalize_opt = 'fracarea'
    output_opt = 'scrip'
    restrict_type = 'latitude'
    num_srch_bins = 90
    luse_grid1_area = .false.
    luse_grid2_area = .false.
    grid1_periodic = .false.
    grid2_periodic = .false.
/
At the beginning I thought problem was the names being very large but I have resized them to small names, nothing change and do get the same behaviour.

The second mistake I get, comes later in line 142:

Code: Select all

       select case(map_method)
       case ('conservative')
         map_type = map_type_conserv
         luse_grid_centers = .false.
       case ('bilinear')
         map_type = map_type_bilinear
         luse_grid_centers = .true.
       case ('bicubic')
         map_type = map_type_bicubic
         luse_grid_centers = .true.
       case ('distwgt')
         map_type = map_type_distwgt
         luse_grid_centers = .true.
       case default
         stop 'unknown mapping method'
       end select
It seems this code is written that way but gfortran (the default compiler in the makefile) does not seem to want to use cases with strings. If I change it to if-then-else if-then-end if statements that part works but the problem in line 138 keeps failing.

Does anybody have ever experienced any problem like this before? Can someone please bring some light into this?
Thank you in advance

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Pyroms scrip Fortran runtime error: Bad FORM parameter in OPEN statement

#2 Unread post by kate »

You are getting further with scrip than I have in years! My advice is to switch to xesmf. I know, it has its own issues, best to make it its own conda environment.

acast
Posts: 1
Joined: Tue Dec 27, 2016 3:36 pm
Location: Woods Hole Oceanographic Institution

Re: Pyroms scrip Fortran runtime error: Bad FORM parameter in OPEN statement

#3 Unread post by acast »

I had the exact same error. The issue was that I needed to install the NetCDF Fortran package in my conda environment. After that, I reinstalled scrip and it worked. But, as Kate said, I ended up just using xesmf since other errors appeared later.

Post Reply