Open sadielbartholomew opened 3 months ago
Hi Sadie, I see where you're coming from, but DimensionCoordinate
and DomainAxis
do not have a sufficiently similar API in this case, so I think that we shouldn't be surprised that former can't correctly instantiate the latter - in particular there is no DimensionCoordinate.set_size
method.
I appreciate that "same API" is slightly vague term. Perhaps we can qualify by saying that "same API for setting the initialisation parameters", or similar
It so happens that dimension coordinates are always 1-d, so it's tempting to think that it's array size could define an axis axis size, but that is clearly not the case for constructs in general - what if the construct had 4-d data?. Is new_domain_axes_1 = cfdm.DomainAxis(dc1.size)
OK for you in this case?
As a side note, the size parameter is accepting arguments that aren't integers, which should also be fixed:
I agree!
Ah, OK, thanks for clarifying David!
I appreciate that "same API" is slightly vague term. Perhaps we can qualify by saying that "same API for setting the initialisation parameters", or similar
Yes, the vagueness is probably the origin of my issue. My interpretation was, a coordinate of any form, as long of course as the coordinates were 1D, should be trivial enough to 'convert' to a Domain Axis with size and name detected. But I wasn't appreciating the subtleties. It would indeed be good to update the phrasing to aim to prevent further confusion from users.
Is new_domain_axes_1 = cfdm.DomainAxis(dc1.size) OK for you in this case?
Yes, though when we catch up today I suspect you will help me realise I don't need to create a domain axis in the first place - in brief, this is for VISION WRF model data work where I have created vertical coordinates emerging as a auxiliary coordinate and ultimately I want the subspace on the z coorindate to use that and not the parametric z coordinate (which isn't working, it is unitless so incomparable anyhow at least I think). My plan was to change the data axes to replace the current parametric z domain axes with the non-parametric calculated one - but hopefully there is a more direct way!
I agree!
I'll change the title here to reflect the much more trivial bug here :)
Using
cfdm.DomainAxis
(and filtering downstream to cf-python, socf.DomainAxis
equivalently) with thesource
keyword to create a Domain Axis construct works fine when the source it itself a Domain Axis, but when it is a coordinate, the produced construct has not size set and is given a generic key name, when these should be inferred from the coordinate data (unless I am missing something and this can't be done), especially from the statement in the documentation for that parameter which says (my bold to highlight):To illustrate:
As a side note, the
size
parameter is accepting arguments that aren't integers, which should also be fixed:Environment