[mpas-developers] trunk commit: I/O for character variables
Doug Jacobsen
jacobsen.douglas at gmail.com
Tue Mar 12 21:29:48 MDT 2013
Hey Michael,
I think this looks good.
Thanks,
Doug
On Mon, Mar 11, 2013 at 6:01 PM, Michael Duda <duda at ucar.edu> wrote:
> Hi, All.
>
> I have a bug fix that I'd like to commit to the trunk. The bug only
> affects time-independent scalar character variables, where we try to
> read or write the variable with length StrKIND, which is equal to 512,
> despite defining the variable with a truncated length of 64 in the file.
> Automatic truncation is handled for scalar character variables with a
> time dimension, and the fix is essentially to do the same for
> time-independent character variables. Here are the changes in mpas_io.F
> (original on the left, new on the right):
>
> 1251c1251,1254
> < pio_ierr = PIO_get_var(handle % pio_file, field_cursor %
> fieldhandle % field_desc, charVal)
> ---
> > start1(1) = 1
> > count1(1) = field_cursor % fieldhandle % dims(1) % dimsize
> > pio_ierr = PIO_get_var(handle % pio_file, field_cursor %
> fieldhandle % fieldid, start1, count1, tempchar)
> > charVal(1:count1(1)) = tempchar(1)(1:count1(1))
> 1646c1649,1651
> < pio_ierr = PIO_put_var(handle % pio_file, field_cursor %
> fieldhandle % field_desc, charVal)
> ---
> > start1(1) = 1
> > count1(1) = field_cursor % fieldhandle % dims(1) % dimsize
> > pio_ierr = PIO_put_var(handle % pio_file, field_cursor %
> fieldhandle % fieldid, start1, count1, (/charVal/))
>
> If anyone would like to test this by, e.g., defining a variable like
>
> var persistent text foo ( ) 0 so foo mesh - -
>
> a patch version of mpas_io.F already exists in
> branches/atmos_physics/src/framework/.
>
> If there are no objections or suggestions for improvement, I'll go ahead
> and commit this fix to the trunk in the next couple of days.
>
> Thanks,
> Michael
> _______________________________________________
> mpas-developers mailing list
> mpas-developers at mailman.ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/mpas-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/mpas-developers/attachments/20130312/75040afe/attachment-0001.html
More information about the mpas-developers
mailing list