Hi Marco, The idea of using Python (perhaps via PyFerret) may be the most natural way to do these sorts of things. CF doesn't have an explicit concept of a "structure", but of course there is a partial analog through the use of shared dimensions (in netCDF) or coordinate axes (in Ferret and CF). String arrays and numeric arrays that share the same coordinate axes, or even multidimensional grids, will share the same coordinate-aware index space. If we think of his variable "B" below as a named axis then, say, define axis/x B={0.1, 0.2, 0.3} So then, "second" is directly connected to "2" through index x=0.2 of axis B, so that LIST/X=0.2 B-myx, B_myywill pick out the associated "structure" elements "second" and 2. Use of families of variable names helps with readability, and Ferret scripts might be used to abstract the definitions and then define various versions of your structure. let vstrings = {"first", "second", "third"}where a script, define_structure.jnl takes the arguments and defines a set of variables. ! define_structure.jnlwould show, !-> sh var B* On 11/12/2015 3:07 AM, Marco van Hulten
wrote:
Hi all, Is it possible to define data structures that are more complex than scalars and arrays? I am talking about records [1], so e.g. let A.x = "some name" let A.y = 10 let A.z = 3.14 Ultimately I'd like to define an array consisting of records: let B.x = {"first name", "second name", "third name"} let B.y = {1, 2, 3} let B.z = {0.1, 0.2, 0.3} or the other way around starting with records and putting them in an array: let C = { A, A2, ... } Note that none of the above command don't work in Ferret, but I hope it is clear what I would like to do :-) Marco [1]: https://en.wikipedia.org/wiki/Record_(computer_science)#Examples |