[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #TTN-133499]: netcdf4 fortran 77



Hi Augusto,

> my name is Augusto and I' doing my phd at the University of Bologna, Italy.
> I'm working with Prof. Nadia Pinardi on an innovative methodology to
> compute oil spill risk for the Portuguese coast using operational
> oceanography as the main tool.
> 
> Our laboratory works on the development of an oil spill model, MEDSLIK-II,
> and that is one of the main tools used on my thesis. The code was written
> on Fortran 77 and it saves all its outputs in ASCII format. Well, since I
> have to handle several simulations with outputs of about ~200 mb, I have
> decided to replace the ASCII strategy by netCDF4.
> 
> So, first of all, your technology is amazing! I've reduced from 200 mb to
> less than 10 mb per simulation. In addition, computational time reduced
> dramatically! I'm surprised. Thanks for making it available. Nevertheless,
> I experienced a weird problem when I started cleaning the code (removing
> the ASCII writing parts).
> 
> The code is something like:
> 
> do 94 nst=1,maxst (in which nst is the timestep and maxst is the final
> timestep)
> 
> all model computations
> 
> if(nst.eq.nprs) then (nprs is a tag which says whether the results
> should or should not be printed)
> add values to my netcdf file
> nprs=nprs+iprs  (this line updates nprs, the print tag)
> 
> enddo
> 
> The code works fine when I generate both ASCII and netCDF outputs. After
> removing the ASCII-writing part (that was only change) I started to get an
> error from the netcdf library:
> 
> Error: No error
> STOP 2
> 
> First of all, I could not understand the message (and I couldnt find it in
> the list of errors presented in Unidata website). I've googled it several
> times and I couldnt find someone that had the same problem. The most
> mysterious part of the story is that if I print on screen "nprs", basically
> adding one single line to the code (underlined), I get no error at all.
> 
> do 94 nst=1,maxst (in which nst is the timestep and maxst is the final
> timestep)
> 
> all model computations
> 
> if(nst.eq.nprs) then (nprs is a tag which says whether the results
> should or should not be printed)
> add values to my netcdf file
> nprs=nprs+iprs  (this line updates nprs, the print tag)
> write(*,*) 'nprs is =', nprs
> 
> enddo
> 
> In sum, there are two things I couldnt understan. First, does the No Error
> message mean? Secondly, why it works perfectly when I print on screen a
> value...

"No error" is the string returned by the F77 netCDF function nf_strerror
when called with an argument of 0, to indicate that a netCDF error
status 0 means no error occurred.  See:

  https://www.unidata.ucar.edu/netcdf/docs/netcdf-f77/NF_005fSTRERROR.html

It may be that your program has a HANDLE_ERR function similar to the
simple error handling function example in the documentation for nf_strerror
referenced above. Perhaps someone used a version of that function without 
the IF statement that prevents it from printing an error message and
stopping when an argument of 0 (the value of the NF_NOERR paramater defined
in the netcdf.inc include file) is provided.

The netCDF F77 library doesn't have that HANDLE_ERR function, it is only
documented as an example, so there must be something like it in your code.
Another remote possibility is that someone has edited the netcdf.inc file
to change the value of NF_NOERR to a non-zero value.

I don't know why printing the value of your loop index changes the symptom
of the problem. That seems weird ...

> Thank you very much for the help! And compliments for the work you've done.
> netCDF4 is really a revolution in data storage.

Thanks, we hope you can figure this out and have success using it.

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: TTN-133499
Department: Support netCDF
Priority: Normal
Status: Closed