Write portion of 2D/3D fortran array in memory to file

Wei-keng Liao wkliao at eecs.northwestern.edu
Thu Dec 18 10:55:13 CST 2014


Hi, Thiago

You can use data(10:90, 10:90). For example,

err = nfmpi_put_vara_real_all(ncid, varid, start, count, data(10:90, 10:90))

In this case, your have to make sure the write amounts are matched, i.e.
  count(1)*count(2) must be equal to 80*80

Wei-keng

On Dec 18, 2014, at 10:36 AM, Thiago Quirino - NOAA Federal wrote:

> Hello, folks.
> 
> I've reading through the Fortran examples and documentation in the Pnetcdf website, and it seems like all calls to nfmpi_put_var* subroutines will write a specified 2D/3D data array found in memory starting at location (1,1) of the array. Suppose that I have a 2D fortran real array of 100x100 elements. For example:
> 
> real(4) :: data(100,100)
> 
> Is it possible to write out only a portion of this 2D array to file without copying the desired portion to another smaller 2D array? For example, can all the elements between data(10,10) and data(90,90) (or 80x80 elements) be written out to file directly, that is, ignoring 10 rows and columns on each side of the data array? These ignored rows and columns correspond to halo points in my application that don't need to be written out.
> 
> Thank you so much,
> Thiago.
> 
> 
> 
> ---------------------------------------------------
> Thiago Quirino, Ph.D.
> NOAA Hurricane Research Division
> Numerical Modeling Group
> 4301 Rickenbacker Cswy.
> Miami, FL 33149
> P: 305-361-4337
> E: Thiago.Quirino at noaa.gov
> http://hwrf.aoml.noaa.gov



More information about the parallel-netcdf mailing list