E3SM-Project / E3SM-Project/scorpio

copy_pio_var() doesn't copy unlimited dimension data

Open
#327 1 comment 0 reactions 1 assignee Claimed by @jayeshkrishna View on GitHub
bug Low Priority
Dominant language
C++
Stars
22
Forks
20
Avg merge
12d 19m
Merged PRs (30d)
1

Description

This call is used in standalone HOMME:

call copy_pio_var(infile%FileID, Outfile%fileid, infile%vars%vardesc(i), outfile%varlist(i)%vardesc, len)

it seems to work well, for all variables except 'time'. For the time array, it doesn't copy the data, both CLASSIC and SCORPIO. At some point, PIO1 was copying this data correctly, but I dont know when this broke ( in PIO1, or in the transition to SCORPIO).

Tracing through the code, its doing something like this:
in pio_nf_utils.F90:

ierr = pio_get_var(ifh, ivid%varid, dval)
ierr = pio_put_var(ofh, ovid%varid, dval)

which goes to (in piofput_mod.F90):
integer function put_var_internal_{TYPE} (ncid,varid, ival) result(ierr)

before finally calling:
ierr=PIOc_put_var_{NCTYPE} (ncid, varid-1, ival)

In the fortran code, SCORPIO is determining the amount of data with the size(dval) function. I've printed this information out and it is correct.

Speculation: In the C code, there is no way to compute the length of the ival pointer, since this metadata from the fortran array has been lost. For non-record dimensions, my guess it that it gets the length from the varid? For a record dimension, like the time() array, this will be unkown to the output file, and thus maybe it returns zero and then doens't write the data?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.