<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hi Tom,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
You have it right.  I actually like that approach -- i.e. store the z data as the primary image and the grid as a table in an extension, though because the axis arrays are different lengths it is a bit awkward -- requiring as you say vector columns.  I should learn to use HDF5, but then I would also have to learn how to access the data (in my case) in IDL (not my choice).  I wish the docs for h5py were a bit better.</div>
<div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Evert, I think you're not understanding the data structure quite.  The data has a non-uniform distribution in x and y, though there are (z) values for every x and y on the grid -- that is, it is a grid but a non-uniform one.  If the grid were uniform I would just specify something like the start point and spacing for each dimension in the header.  In this case, it is possible to specify all the values for each dimension in the header, though not quite so convenient.</div>
<div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Jon</div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Dec 23, 2013 at 12:40 PM, Aldcroft, Thomas <span dir="ltr"><<a href="mailto:aldcroft@head.cfa.harvard.edu" target="_blank">aldcroft@head.cfa.harvard.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="im">On Mon, Dec 23, 2013 at 11:16 AM, Slavin, Jonathan <span dir="ltr"><<a href="mailto:jslavin@cfa.harvard.edu" target="_blank">jslavin@cfa.harvard.edu</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif">


Hi all,</div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">
Maybe I'm being dense today, but I'm not clear on how to do something pretty basic.  The issue is that I have essentially 3-D data wherein the data is not known on a uniform grid.  That is, although the data is on an x-y grid, neither the x values nor the y values are uniform.  I want to save the values (i.e. z values) at each point in the grid in a fits file.  The natural thing to do is either create an image or a table, but specifying the grid is not quite so straightforward in either case.  For a table one could have one column be an axis (e.g. 'y') and save the y values, but then the x values are the table column 'names', which I think have to be strings.  Nothing is fundamentally unworkable about that, it's just a little awkward to have string versions of the numeric axis values.  If I output an image instead, then I'm left with specifying the grid locations in the header.</div>


</div></blockquote><div><br></div></div><div>If I understand, you have data values Z on a rectilinear 2-d grid (X, Y).  If so one solution I've seen before [1] is storing an image in the primary HDU and then the X and Y grid values in the second HDU as a table with two columns X, Y and just one row.  Each of those two columns is actually a vector of the appropriate length.  This is a little contorted, but FITS is not an ideal match for this.</div>


<div><br></div><div>[1] I forget exactly where, but there is a FITS standard for calibration data products that uses this layout for N-d data defined on rectilinear grids.</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div dir="ltr">
<div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">So, I do have ways of doing what I want to do, but it just seems that the ways I've thought of are not the simplest ways.  And I wonder if there isn't some other way that I haven't thought of.  Any hints on this would be appreciated.  Maybe some other output format (e.g. hdf5) would be better?</div>


</div></blockquote><div><br></div></div><div>Certainly HDF5 is more flexible and would let you store the two vectors of X and Y grid locations in a more natural way.</div><div><br></div><div>- Tom</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">

<div dir="ltr">
<div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">Jon</div><span><font color="#888888"><div><br></div>-- <br><div dir="ltr">________________________________________________________<br>



Jonathan D. Slavin                 Harvard-Smithsonian CfA<br><a href="mailto:jslavin@cfa.harvard.edu" target="_blank">jslavin@cfa.harvard.edu</a>       60 Garden Street, MS 83<br>phone: <a href="tel:%28617%29%20496-7981" value="+16174967981" target="_blank">(617) 496-7981</a>       Cambridge, MA 02138-1516<br>



fax: <a href="tel:%28617%29%20496-7577" value="+16174967577" target="_blank">(617) 496-7577</a>            USA<br>________________________________________________________<br><br></div>
</font></span></div>
<br></div><div class="im">_______________________________________________<br>
AstroPy mailing list<br>
<a href="mailto:AstroPy@scipy.org" target="_blank">AstroPy@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/astropy" target="_blank">http://mail.scipy.org/mailman/listinfo/astropy</a><br>
<br></div></blockquote></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">________________________________________________________<br>Jonathan D. Slavin                 Harvard-Smithsonian CfA<br><a href="mailto:jslavin@cfa.harvard.edu" target="_blank">jslavin@cfa.harvard.edu</a>       60 Garden Street, MS 83<br>
phone: (617) 496-7981       Cambridge, MA 02138-1516<br>fax: (617) 496-7577            USA<br>________________________________________________________<br><br></div>
</div></div>