I am having some issues with writing EFMAP_LAI.csv file with about 192000 plus grids into netcdf ioapi format using the mg2ioapi executable in megan-v2.04
The conversion process only seems to work for EFMAP_LAI.csv file with grid values of up to 93000 beyond this value of grid number it gives the following error:
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error: #0 0x2B93F632A6D7 #1 0x2B93F632AD1E #2 0x2B93F6DBD3EF #3 0x4041F8 in MAIN__ at mg2ioapi.F:146
Segmentation fault (core dumped)
This happens every time which is a bit frustrating.
Also, can please ioapi or megan programme define the values for X and Y when writing a .csv file into netcdf ioapi?
This sort of thing (where a seg-fault occurs as the problem-size increases) suggests that you may need to compile everything with the “medium” 64-bit memory model instead of the default “small” moidel. See Notes on Linux2_x86_64 memory models.
we have encounted similar issue with MEGAN v2.1, when generating the LAI ncf.
It stops in LAI24, while we have LAI46 in the csv file:
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
#0 0x2B7E81AC2697
#1 0x2B7E81AC2CDE
#2 0x2B7E8299727F
#3 0x40FC6D in nextime_
#4 0x409501 in cnvt_lai_
#5 0x40A50A in MAIN__ at txt2ioapi.F:?
Segmentation fault (core dumped)
I have tried to compile ioapi-3.2 with Linux2_x86_64gfort_medium, and recompile MEGAN, but the same error happens again. Would you please give more details how to deal with that?
This is a programming error in that program’s SUBROUTINE CNVT_LAI, at line 160:
CALL NEXTIME( 0 , ITIME, TSTEP3D )
See https://cjcoats.github.io/ioapi/NEXTIME.html: I/O API subroutine NEXTIME( JDATE,JTIME.TSTEP) sets its first two arguments JDATE and JTIME by updating them by the time step TSTEP: this call in code is CNVT_LAI is trying to change the value of zero, and the computer (properly) complains!
If the author of this code had bothered to follow the recommendation to USE M3UTILIO in order to have explicit Fortran-90 interfaces for all the I/O API subroutines–a recommendation that has been in place for twenty-two years–this error would have been caught at compile-time and the code would have been fixed before it even got by preliminary testing!