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

[netCDF #KJN-301947]: Writing a Subset of a 3-D Array to a NetCDF File



Ben,

It looks like you just need to replace the nf_put_var_int() call
in your program with the following:

c ... Output 3 x 2 x 5 subset of full-size array
      start(1) = 1
      start(2) = 1
      start(3) = 1

      count(1) = 5
      count(2) = 2
      count(3) = 3

      stride(1) = 1
      stride(2) = 1
      stride(3) = 1

C Distance between successive elements along axes in memory of data_out array
      map(1) =     1
      map(2) =   5*1
      map(3) = 4*5*1

      ret = nf_put_varm_int(ncid, varid, start, count, stride,
     *                      map, data_out)

Then ncdump shows the elements that were written as well as fill values for the
unwritten elements:


 data =
  111, 112, 113, 114, 115,
  121, 122, 123, 124, 125,
  _, _, _, _, _,
  _, _, _, _, _,
  211, 212, 213, 214, 215,
  221, 222, 223, 224, 225,
  _, _, _, _, _,
  _, _, _, _, _,
  311, 312, 313, 314, 315,
  321, 322, 323, 324, 325,
  _, _, _, _, _,
  _, _, _, _, _ ;

--Russ

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



Ticket Details
===================
Ticket ID: KJN-301947
Department: Support netCDF
Priority: Normal
Status: Closed