Implementing own data functions
- To: mathgroup at smc.vnet.net
- Subject: [mg84120] Implementing own data functions
- From: Mac <mwjdavidson at googlemail.com>
- Date: Mon, 10 Dec 2007 20:43:44 -0500 (EST)
Mathematica 6 comes with useful data functions covering topics ranging from financial data to chemical isotope decay chains. Having established the syntax and functionality through these functions, it would make sense to me if there was a mechanism for users to build up their own data functions. It would be a useful way of sharing data with other users. Unfortunately I haven't come across any tutorial or description of how data functions are implemented. As far as I can make out some of the features of data functions are similar to associative arrays (or hashes) as found in other languages such as Perl. Indeed, I've starting putting together some very simple data on radar satellite missions and launch rockets but using a simple 1 level hash-like syntax. An example is provided below. Does anybody have a better insight or examples of how WRI data functions are implemented and could be made to work for individual efforts ? Many thanks Mac Here an example for the Japanese JERS-1 satellite Clear[jers1, keys] keys[hash_] := Map[#[[1, 1, 1]] &, DownValues[hash]]; jers1["Platform"] = { {"Dates", "monthdayyear", {"February 11, 1992", "October 11, 1992"}}, {"Repeatcycle", "days", 44}, {"Altitude", "km", 568}, {"OrbitInclination", "deg", 97.67}, {"Rollerr", "deg", 0.12}, {"Rollerr", "deg", 0.16}, {"Yawerr", "deg", 0.13} }; jers1["SARPayload"] = { {"Frequency", "Ghz", 1.275}, {"AntennaLength", "m", 11.9 }, {"AntennaWidth", "m", 2.4}, {"Bandwidth", "MHz", 15}, {"PRF", "Hz", {1505, 1602}}, {"Look direction", " ", "right"}, {"NumberModes", " ", 1}};