ESMG / pyroms

Python tools for the Regional Ocean Modeling System (ROMS)
Other
138 stars 88 forks source link

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

Open crargr opened 2 years ago

crargr commented 2 years ago

Hello there!, hope all is 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:

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

$ 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:

&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:

  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.

I wonder if I could get some help here. Thank you in advance

aiwuyouxi commented 5 months ago

Hello,bro! How did you solve it? I met the same problem 😥 111