NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

[netcdfgroup] nf90_put_var doesn't write data into file.

Dear all,

I'm trying to write 4-d data (longitude, latitude, level, time) into an "nc"
file, but I only got the description header of the variable, no real data
were written.  The structure of my code is:

main program
   ....
   call sub_def_file(chk_ncid, varid)
   ....
   call write_nc(chk_ncid, varid)
   ....
end main program

write_nc.f90 is like this:
 ...
  count = (/nc_lon, nc_lat, nc_lev, 1, 1/)
  start = (/ 1, 1, 1, 1, 1 /)
  call nc_check(nf90_put_var( &
                    chk_ncid,  &
                    nc_data_varid,  &
                    nc_data_out,  &
                    start=start,  &
                    count=count  &
                   ))
...

The sub_def_file is like this:
  ...
         call nc_check (nf90_put_att(chk_ncid, varid(nc_i), VDESC,
RJ_VDESC))
           enddo
!- End define mode.
        call nc_check( nf90_enddef(chk_ncid))
  end subroutine sub_def_file


Could you please find apparent mistakes in the code? Appreciate!
-- 
Cordially,
Hongyan
  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: