Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Problem with porting of Linux code to Windows, FORTRAN/C.

Hello,

There is a Linux console tool (written in FORTRAN/C) which I want to port under Windows. It can be started with one parameter:

$gribprint gfs1.grib

Example output on the console:

--------------------------------------------------
rec GRIB Lvl Lvl Lvl Time Fcst
Num Code Code one two hour
--------------------------------------------------
1 11 1 0 0 2005-10-11_00:00 +00

I have success with the compilation of the program under Windows. If I run it without argument it works fine and displays a help message. But if I run it with an argument (gfs1.grib) it starts to read the file and then it gives error message (it says that error log is created but I can't find it, W2K). The file is ok. I'm wondering where is the problem and I guess that it's in the file:

/regrid/pregrid/util/cio.c

where are the I/O (read & write) functions. Here are the original sources for UNIX/Linux:

ftp://ftp.ucar.edu/mesouser/MM5V3/REGRID.TAR.gz

Thanks for any ideas!


Best Regards,

Angel

Comments

  • Griz803Griz803 Member Posts: 100
    ...Hmmm...
    :
    : $gribprint gfs1.grib
    :
    Check the file location to be sure that it's in the same directory with the program, recheck your compiler and linker settings to be sure that it was compiled with the fussiest level of warnings and errors on. Then you might try simply renaming the file your trying to pass it with a short extension. What type of data is in your "*.grib" file? Binary or text? If it is text, you may still have a problem because the C compiler that you compile with won't handle the OS dependant newlines correctly just because you recompiled and got no errors. Windows uses a carriage return and *nix uses a pair consisting of CR/NL. Or vice versa, sorry but its been a while. If it is a text file, I'd run Linux to dos on it. It's a free utility (Linux2DOS.EXE) and works fine. Hope one of these ideas gets it running for you.
  • stormlabstormlab Member Posts: 3

    > What type of data is in your "*.grib" file?

    GRIB is a standard format for weather data in binary format - GRIdded Binary.

    > Linux2DOS.EXE

    I tried to get fresh GRIB file from one server and I stored directly on my Windows partition. I will try to look more closely in the source codes to find what do the functions read(), lseek(), perror().

    Thanks for your help!

    Angel

    : ...Hmmm...
    : :
    : : $gribprint gfs1.grib
    : :
    : Check the file location to be sure that it's in the same directory with the program, recheck your compiler and linker settings to be sure that it was compiled with the fussiest level of warnings and errors on. Then you might try simply renaming the file your trying to pass it with a short extension. What type of data is in your "*.grib" file? Binary or text? If it is text, you may still have a problem because the C compiler that you compile with won't handle the OS dependant newlines correctly just because you recompiled and got no errors. Windows uses a carriage return and *nix uses a pair consisting of CR/NL. Or vice versa, sorry but its been a while. If it is a text file, I'd run Linux to dos on it. It's a free utility (Linux2DOS.EXE) and works fine. Hope one of these ideas gets it running for you.
    :

Sign In or Register to comment.