Open karlmsmith opened 7 years ago
Modified by @AnsleyManke on 26 Sep 2013 17:57 UTC
Comment by @AnsleyManke on 26 Sep 2013 18:03 UTC Here is a proposed set of changes to complete the work, changing the interpretation of indices on reverse-ordered axes. Continuing to support the reversed axes as in-memory, forward-ordered variables, but making this transparent to users:
get the user's "/K=lo:hi" to be interpreted in a manner consistent with the reverse ordered axis *FLESH_OUT_AXIS seems the best place to do this. It is at this point that there is a guarantee that both the grid and the user's K= (or other index) request are known
*add new variable to xcontext: cx_reversal_has_been_applied(maxcx, maxferrdims) (the long name is for clarity here)
* IF ( axis_is_reversed
AND .NOT.cx_reversal_has_been_applied(cx, idim)
AND cx_by_ss(idim,cx) ) THEN
cx_lo_ss(cx,idim) = axlen-cx_lo_ss(cx,idim)+1
cx_hi_ss(cx,idim) = axlen-cx_hi_ss(cx,idim)+1
cx_reversal_has_been_applied(cx, idim) = TRUE
ENDIF
Reported by @AnsleyManke on 20 Sep 2013 18:23 UTC Our GFDL friends wrote us with the question quoted below, about Ferret's handling of axes with decreasing coordinates. We will be discussing how to resolve this in general.
An element of this which we can immediately address is to have Ferret WRITE data and axes in the same reversed order as in the dataset. Any variable defined on a grid which includes an axis that Ferret marked as reversed should be written with the coordinates and data reversed. In fact there is a NetCDF call to write data with a mapping vector for ordering the data, just as there is a call to read data in a permuted order.
I think we should do this by default, perhaps issuing a NOTE. This goes along with our efforts in recent Ferret releases to write netCDF files that conform to the original dataset as much as possible.
Migrated-From: http://dunkel.pmel.noaa.gov/trac/ferret/ticket/2093