Skip to content

Instantly share code, notes, and snippets.

@stuartlynn
Last active Jul 31, 2019
Embed
What would you like to do?
Temperature Anomaly sculpture
// title : OpenJSCAD.org Logo
// author : Rene K. Mueller
// license : MIT License
// revision : 0.003
// tags : Logo,Intersection,Sphere,Cube
// file : logo.jscad
data = {"1880": [-0.3, -0.21, -0.18, -0.27, -0.14, -0.29, -0.24, -0.08, -0.17, -0.16, -0.19, -0.22], "1881": [-0.1, -0.14, 0.01, -0.03, -0.04, -0.28, -0.07, -0.03, -0.09, -0.2, -0.26, -0.16], "1882": [0.09, 0.08, 0.01, -0.2, -0.18, -0.25, -0.11, 0.03, -0.01, -0.23, -0.21, -0.25], "1883": [-0.34, -0.42, -0.18, -0.25, -0.26, -0.13, -0.09, -0.14, -0.19, -0.12, -0.21, -0.19], "1884": [-0.18, -0.13, -0.36, -0.36, -0.32, -0.38, -0.35, -0.27, -0.24, -0.22, -0.3, -0.3], "1885": [-0.66, -0.3, -0.24, -0.45, -0.42, -0.5, -0.29, -0.27, -0.19, -0.2, -0.22, -0.07], "1886": [-0.43, -0.46, -0.41, -0.29, -0.27, -0.39, -0.16, -0.31, -0.19, -0.25, -0.26, -0.25], "1887": [-0.66, -0.48, -0.32, -0.37, -0.33, -0.21, -0.19, -0.28, -0.19, -0.32, -0.25, -0.38], "1888": [-0.43, -0.43, -0.47, -0.28, -0.22, -0.2, -0.1, -0.11, -0.07, 0.01, 0.0, -0.12], "1889": [-0.21, 0.14, 0.04, 0.04, -0.03, -0.12, -0.05, -0.18, -0.18, -0.22, -0.32, -0.31], "1890": [-0.48, -0.48, -0.41, -0.38, -0.48, -0.27, -0.3, -0.36, -0.36, -0.23, -0.37, -0.3], "1891": [-0.46, -0.49, -0.15, -0.25, -0.17, -0.22, -0.22, -0.21, -0.13, -0.24, -0.37, -0.03], "1892": [-0.26, -0.15, -0.36, -0.35, -0.25, -0.2, -0.28, -0.2, -0.25, -0.17, -0.49, -0.29], "1893": [-0.69, -0.51, -0.24, -0.32, -0.35, -0.24, -0.14, -0.24, -0.18, -0.16, -0.17, -0.38], "1894": [-0.55, -0.31, -0.2, -0.41, -0.3, -0.43, -0.32, -0.29, -0.23, -0.17, -0.25, -0.22], "1895": [-0.44, -0.42, -0.3, -0.23, -0.23, -0.25, -0.16, -0.16, -0.02, -0.11, -0.15, -0.12], "1896": [-0.23, -0.15, -0.29, -0.33, -0.19, -0.13, -0.06, -0.09, -0.05, 0.04, -0.16, -0.12], "1897": [-0.22, -0.19, -0.12, -0.01, 0.0, -0.12, -0.04, -0.03, -0.04, -0.1, -0.18, -0.26], "1898": [-0.06, -0.34, -0.55, -0.33, -0.35, -0.2, -0.22, -0.22, -0.19, -0.32, -0.35, -0.22], "1899": [-0.18, -0.39, -0.35, -0.21, -0.2, -0.26, -0.13, -0.04, 0.0, 0.0, 0.12, -0.27], "1900": [-0.4, -0.08, 0.02, -0.14, -0.06, -0.15, -0.09, -0.04, 0.01, 0.08, -0.13, -0.14], "1901": [-0.3, -0.05, 0.05, -0.06, -0.18, -0.1, -0.09, -0.13, -0.17, -0.29, -0.17, -0.3], "1902": [-0.19, -0.03, -0.29, -0.27, -0.31, -0.34, -0.26, -0.28, -0.2, -0.27, -0.36, -0.46], "1903": [-0.27, -0.06, -0.23, -0.39, -0.41, -0.44, -0.3, -0.44, -0.43, -0.42, -0.38, -0.47], "1904": [-0.64, -0.55, -0.46, -0.5, -0.5, -0.49, -0.48, -0.43, -0.47, -0.35, -0.16, -0.29], "1905": [-0.38, -0.59, -0.25, -0.36, -0.33, -0.31, -0.25, -0.21, -0.15, -0.23, -0.08, -0.21], "1906": [-0.31, -0.34, -0.15, -0.02, -0.21, -0.22, -0.27, -0.19, -0.25, -0.2, -0.38, -0.18], "1907": [-0.44, -0.53, -0.25, -0.4, -0.46, -0.43, -0.35, -0.37, -0.32, -0.24, -0.51, -0.5], "1908": [-0.46, -0.36, -0.58, -0.46, -0.4, -0.39, -0.35, -0.45, -0.33, -0.43, -0.51, -0.5], "1909": [-0.7, -0.47, -0.52, -0.59, -0.54, -0.52, -0.43, -0.3, -0.37, -0.39, -0.31, -0.55], "1910": [-0.44, -0.43, -0.47, -0.39, -0.34, -0.36, -0.31, -0.34, -0.37, -0.39, -0.56, -0.69], "1911": [-0.64, -0.6, -0.62, -0.55, -0.51, -0.47, -0.41, -0.43, -0.38, -0.26, -0.2, -0.25], "1912": [-0.27, -0.13, -0.37, -0.2, -0.2, -0.26, -0.41, -0.51, -0.47, -0.55, -0.38, -0.42], "1913": [-0.41, -0.44, -0.44, -0.36, -0.45, -0.46, -0.34, -0.32, -0.32, -0.34, -0.18, -0.04], "1914": [0.02, -0.13, -0.23, -0.28, -0.19, -0.22, -0.24, -0.15, -0.13, -0.05, -0.2, -0.1], "1915": [-0.2, -0.01, -0.08, 0.07, -0.01, -0.16, -0.03, -0.15, -0.12, -0.22, -0.12, -0.25], "1916": [-0.2, -0.23, -0.31, -0.25, -0.27, -0.44, -0.34, -0.27, -0.29, -0.28, -0.42, -0.78], "1917": [-0.46, -0.53, -0.47, -0.38, -0.48, -0.4, -0.23, -0.26, -0.18, -0.35, -0.29, -0.71], "1918": [-0.44, -0.33, -0.21, -0.4, -0.37, -0.28, -0.22, -0.26, -0.14, -0.03, -0.16, -0.3], "1919": [-0.21, -0.19, -0.25, -0.17, -0.2, -0.28, -0.21, -0.19, -0.17, -0.16, -0.29, -0.35], "1920": [-0.15, -0.22, -0.08, -0.26, -0.26, -0.33, -0.32, -0.29, -0.2, -0.29, -0.33, -0.47], "1921": [-0.04, -0.21, -0.28, -0.36, -0.36, -0.31, -0.16, -0.24, -0.16, -0.06, -0.16, -0.18], "1922": [-0.34, -0.44, -0.13, -0.22, -0.34, -0.32, -0.27, -0.31, -0.29, -0.33, -0.17, -0.17], "1923": [-0.27, -0.37, -0.32, -0.38, -0.33, -0.24, -0.29, -0.3, -0.28, -0.13, 0.03, -0.06], "1924": [-0.24, -0.27, -0.12, -0.35, -0.19, -0.28, -0.27, -0.35, -0.3, -0.36, -0.23, -0.43], "1925": [-0.34, -0.35, -0.24, -0.25, -0.3, -0.34, -0.3, -0.19, -0.13, -0.17, 0.03, 0.11], "1926": [0.2, 0.07, 0.12, -0.15, -0.25, -0.25, -0.21, -0.11, -0.11, -0.11, -0.06, -0.3], "1927": [-0.28, -0.21, -0.39, -0.31, -0.25, -0.27, -0.15, -0.19, -0.06, -0.01, -0.04, -0.36], "1928": [-0.04, -0.12, -0.28, -0.29, -0.3, -0.41, -0.21, -0.25, -0.2, -0.19, -0.09, -0.2], "1929": [-0.47, -0.61, -0.34, -0.4, -0.39, -0.43, -0.33, -0.29, -0.23, -0.15, -0.14, -0.55], "1930": [-0.29, -0.24, -0.08, -0.26, -0.25, -0.19, -0.17, -0.11, -0.11, -0.08, 0.14, -0.09], "1931": [-0.1, -0.22, -0.06, -0.21, -0.22, -0.06, 0.01, 0.0, -0.06, 0.0, -0.12, -0.1], "1932": [0.13, -0.18, -0.2, -0.07, -0.22, -0.3, -0.24, -0.24, -0.11, -0.1, -0.26, -0.22], "1933": [-0.34, -0.32, -0.29, -0.23, -0.25, -0.32, -0.2, -0.23, -0.26, -0.24, -0.31, -0.47], "1934": [-0.27, -0.04, -0.31, -0.27, -0.11, -0.14, -0.11, -0.1, -0.16, -0.11, -0.01, -0.09], "1935": [-0.37, 0.11, -0.13, -0.35, -0.26, -0.23, -0.19, -0.17, -0.17, -0.08, -0.29, -0.22], "1936": [-0.29, -0.39, -0.23, -0.2, -0.17, -0.19, -0.06, -0.12, -0.06, -0.04, -0.05, -0.04], "1937": [-0.11, 0.05, -0.17, -0.17, -0.07, -0.08, -0.05, 0.03, 0.14, 0.1, 0.09, -0.12], "1938": [0.0, -0.04, 0.05, 0.05, -0.07, -0.17, -0.09, -0.04, 0.03, 0.11, 0.01, -0.26], "1939": [-0.13, -0.12, -0.2, -0.12, -0.07, -0.08, -0.06, -0.05, 0.0, -0.03, 0.06, 0.4], "1940": [-0.15, 0.06, 0.12, 0.16, 0.05, 0.05, 0.1, 0.01, 0.12, 0.07, 0.13, 0.19], "1941": [0.13, 0.23, 0.06, 0.11, 0.1, 0.04, 0.15, 0.14, 0.02, 0.24, 0.12, 0.14], "1942": [0.26, 0.05, 0.13, 0.14, 0.14, 0.11, 0.02, -0.03, 0.0, 0.06, 0.13, 0.12], "1943": [-0.01, 0.22, 0.01, 0.13, 0.1, -0.01, 0.14, 0.03, 0.11, 0.3, 0.25, 0.28], "1944": [0.41, 0.31, 0.34, 0.27, 0.26, 0.22, 0.23, 0.23, 0.31, 0.27, 0.12, 0.05], "1945": [0.13, 0.02, 0.11, 0.24, 0.1, 0.02, 0.07, 0.25, 0.22, 0.22, 0.1, -0.1], "1946": [0.15, 0.06, 0.0, 0.11, -0.04, -0.17, -0.09, -0.08, -0.02, -0.06, -0.02, -0.29], "1947": [-0.13, -0.08, 0.05, 0.04, -0.06, 0.0, -0.06, -0.08, -0.14, 0.06, -0.01, -0.18], "1948": [0.05, -0.13, -0.23, -0.09, 0.08, -0.05, -0.13, -0.1, -0.1, -0.07, -0.08, -0.23], "1949": [0.09, -0.16, -0.01, -0.07, -0.09, -0.22, -0.13, -0.08, -0.08, -0.03, -0.08, -0.19], "1950": [-0.3, -0.26, -0.06, -0.21, -0.12, -0.06, -0.09, -0.18, -0.1, -0.2, -0.35, -0.2], "1951": [-0.35, -0.44, -0.19, -0.1, -0.02, -0.05, 0.0, 0.05, 0.07, 0.06, 0.0, 0.15], "1952": [0.16, 0.12, -0.1, 0.02, -0.05, -0.04, 0.05, 0.07, 0.08, -0.04, -0.17, -0.02], "1953": [0.09, 0.16, 0.11, 0.2, 0.08, 0.08, 0.02, 0.08, 0.06, 0.05, -0.05, 0.03], "1954": [-0.28, -0.1, -0.12, -0.18, -0.2, -0.16, -0.16, -0.13, -0.07, -0.01, 0.08, -0.18], "1955": [0.11, -0.21, -0.36, -0.23, -0.2, -0.08, -0.09, 0.04, -0.13, -0.05, -0.28, -0.32], "1956": [-0.17, -0.25, -0.23, -0.26, -0.28, -0.15, -0.12, -0.25, -0.22, -0.24, -0.17, -0.1], "1957": [-0.14, -0.05, -0.05, -0.04, 0.08, 0.16, 0.01, 0.14, 0.06, 0.01, 0.07, 0.16], "1958": [0.39, 0.24, 0.1, 0.01, 0.08, -0.05, 0.06, -0.06, -0.03, 0.04, 0.02, 0.01], "1959": [0.06, 0.09, 0.19, 0.16, 0.06, 0.02, 0.06, -0.01, -0.06, -0.09, -0.09, -0.03], "1960": [-0.01, 0.14, -0.36, -0.16, -0.08, 0.01, -0.02, -0.01, 0.05, 0.07, -0.11, 0.18], "1961": [0.07, 0.18, 0.09, 0.15, 0.13, 0.12, -0.03, 0.02, 0.05, 0.0, 0.03, -0.15], "1962": [0.08, 0.14, 0.12, 0.05, -0.06, 0.06, -0.02, -0.02, -0.01, -0.03, 0.06, -0.01], "1963": [-0.03, 0.19, -0.13, -0.05, -0.09, 0.03, 0.08, 0.25, 0.2, 0.15, 0.15, 0.0], "1964": [-0.06, -0.12, -0.22, -0.3, -0.25, -0.07, -0.07, -0.2, -0.28, -0.3, -0.21, -0.3], "1965": [-0.09, -0.17, -0.11, -0.2, -0.14, -0.08, -0.12, -0.01, -0.15, -0.04, -0.06, -0.05], "1966": [-0.16, 0.0, 0.04, -0.13, -0.1, 0.02, 0.09, -0.1, -0.01, -0.15, -0.02, -0.06], "1967": [-0.06, -0.2, 0.03, -0.05, 0.14, -0.08, 0.01, 0.02, -0.04, 0.06, -0.06, -0.02], "1968": [-0.23, -0.15, 0.21, -0.05, -0.1, -0.06, -0.11, -0.11, -0.18, 0.12, -0.04, -0.14], "1969": [-0.11, -0.14, 0.0, 0.19, 0.2, 0.05, -0.01, 0.03, 0.1, 0.11, 0.12, 0.27], "1970": [0.09, 0.22, 0.08, 0.09, -0.05, -0.03, -0.04, -0.11, 0.11, 0.05, 0.01, -0.13], "1971": [-0.02, -0.2, -0.18, -0.09, -0.06, -0.18, -0.12, -0.03, -0.01, -0.05, -0.04, -0.08], "1972": [-0.24, -0.17, 0.02, -0.01, -0.03, 0.04, 0.02, 0.18, 0.03, 0.09, 0.03, 0.18], "1973": [0.28, 0.3, 0.26, 0.25, 0.26, 0.16, 0.09, 0.02, 0.06, 0.12, 0.06, -0.06], "1974": [-0.14, -0.28, -0.05, -0.1, -0.01, -0.05, -0.03, 0.12, -0.12, -0.07, -0.07, -0.09], "1975": [0.07, 0.07, 0.14, 0.06, 0.16, -0.02, -0.03, -0.2, -0.03, -0.09, -0.16, -0.17], "1976": [0.0, -0.06, -0.21, -0.1, -0.23, -0.15, -0.12, -0.18, -0.09, -0.26, -0.06, 0.09], "1977": [0.18, 0.2, 0.25, 0.27, 0.3, 0.25, 0.23, 0.19, 0.02, 0.04, 0.2, 0.05], "1978": [0.08, 0.14, 0.21, 0.15, 0.07, -0.03, 0.07, -0.18, 0.05, 0.0, 0.16, 0.11], "1979": [0.14, -0.09, 0.19, 0.13, 0.06, 0.14, 0.03, 0.14, 0.27, 0.26, 0.29, 0.47], "1980": [0.3, 0.42, 0.29, 0.32, 0.34, 0.16, 0.28, 0.24, 0.21, 0.2, 0.3, 0.21], "1981": [0.56, 0.41, 0.48, 0.32, 0.25, 0.31, 0.35, 0.35, 0.17, 0.13, 0.21, 0.4], "1982": [0.09, 0.14, -0.01, 0.1, 0.16, 0.05, 0.13, 0.08, 0.15, 0.13, 0.14, 0.43], "1983": [0.52, 0.4, 0.42, 0.3, 0.35, 0.18, 0.15, 0.3, 0.38, 0.15, 0.3, 0.17], "1984": [0.3, 0.17, 0.29, 0.08, 0.33, 0.04, 0.16, 0.15, 0.2, 0.15, 0.04, -0.06], "1985": [0.21, -0.06, 0.17, 0.11, 0.17, 0.17, 0.0, 0.15, 0.14, 0.11, 0.09, 0.15], "1986": [0.3, 0.39, 0.29, 0.26, 0.26, 0.12, 0.13, 0.12, 0.02, 0.14, 0.11, 0.16], "1987": [0.36, 0.46, 0.17, 0.24, 0.26, 0.36, 0.46, 0.28, 0.39, 0.32, 0.25, 0.47], "1988": [0.57, 0.42, 0.49, 0.45, 0.44, 0.42, 0.35, 0.46, 0.42, 0.4, 0.13, 0.34], "1989": [0.16, 0.35, 0.36, 0.33, 0.17, 0.15, 0.34, 0.36, 0.37, 0.32, 0.21, 0.37], "1990": [0.41, 0.41, 0.76, 0.55, 0.46, 0.38, 0.44, 0.3, 0.3, 0.43, 0.46, 0.42], "1991": [0.42, 0.51, 0.36, 0.53, 0.39, 0.54, 0.51, 0.42, 0.5, 0.32, 0.31, 0.33], "1992": [0.45, 0.42, 0.47, 0.24, 0.32, 0.24, 0.13, 0.1, 0.01, 0.11, 0.04, 0.22], "1993": [0.37, 0.39, 0.36, 0.28, 0.26, 0.24, 0.28, 0.13, 0.11, 0.24, 0.07, 0.19], "1994": [0.3, 0.04, 0.26, 0.41, 0.29, 0.42, 0.32, 0.23, 0.32, 0.42, 0.46, 0.36], "1995": [0.5, 0.77, 0.45, 0.47, 0.29, 0.45, 0.49, 0.48, 0.34, 0.49, 0.45, 0.3], "1996": [0.27, 0.5, 0.34, 0.38, 0.3, 0.27, 0.37, 0.49, 0.27, 0.2, 0.42, 0.41], "1997": [0.33, 0.37, 0.52, 0.38, 0.39, 0.55, 0.35, 0.43, 0.56, 0.64, 0.66, 0.6], "1998": [0.61, 0.9, 0.63, 0.64, 0.71, 0.78, 0.71, 0.68, 0.45, 0.47, 0.5, 0.56], "1999": [0.48, 0.66, 0.34, 0.34, 0.33, 0.37, 0.41, 0.34, 0.43, 0.43, 0.42, 0.46], "2000": [0.26, 0.58, 0.6, 0.59, 0.4, 0.44, 0.42, 0.43, 0.42, 0.3, 0.34, 0.3], "2001": [0.44, 0.46, 0.58, 0.52, 0.59, 0.55, 0.61, 0.49, 0.56, 0.52, 0.7, 0.55], "2002": [0.75, 0.76, 0.91, 0.58, 0.65, 0.54, 0.62, 0.55, 0.65, 0.57, 0.59, 0.43], "2003": [0.73, 0.55, 0.57, 0.55, 0.62, 0.49, 0.55, 0.66, 0.66, 0.75, 0.55, 0.75], "2004": [0.59, 0.71, 0.64, 0.62, 0.42, 0.43, 0.26, 0.45, 0.53, 0.66, 0.72, 0.52], "2005": [0.72, 0.58, 0.69, 0.69, 0.65, 0.67, 0.66, 0.63, 0.78, 0.8, 0.76, 0.68], "2006": [0.57, 0.7, 0.63, 0.5, 0.47, 0.64, 0.54, 0.72, 0.64, 0.69, 0.72, 0.77], "2007": [0.96, 0.7, 0.7, 0.76, 0.67, 0.58, 0.62, 0.6, 0.64, 0.6, 0.57, 0.5], "2008": [0.24, 0.36, 0.73, 0.53, 0.51, 0.48, 0.6, 0.44, 0.65, 0.67, 0.66, 0.54], "2009": [0.62, 0.53, 0.53, 0.61, 0.65, 0.65, 0.72, 0.66, 0.7, 0.64, 0.77, 0.65], "2010": [0.73, 0.78, 0.92, 0.87, 0.75, 0.64, 0.62, 0.65, 0.61, 0.71, 0.79, 0.49], "2011": [0.51, 0.53, 0.64, 0.65, 0.53, 0.59, 0.73, 0.73, 0.56, 0.66, 0.56, 0.54], "2012": [0.46, 0.49, 0.58, 0.69, 0.76, 0.62, 0.57, 0.63, 0.76, 0.78, 0.75, 0.53], "2013": [0.68, 0.55, 0.66, 0.52, 0.61, 0.65, 0.59, 0.66, 0.78, 0.69, 0.81, 0.67], "2014": [0.73, 0.51, 0.77, 0.78, 0.87, 0.66, 0.57, 0.82, 0.9, 0.85, 0.67, 0.79], "2015": [0.81, 0.86, 0.9, 0.74, 0.78, 0.78, 0.71, 0.78, 0.81, 1.06, 1.04, 1.11]}
function main () {
var heightStep = 1;
// console.log(data)
fd = {}
filtered_years = Object.keys(data).filter(k=> k> 1950);
var rings =filtered_years.map((year,index)=> {
console.log('doing year ', year);
try{
return makeYearRing(data[year], 10,20,heightStep).translate([0,0,heightStep*index])
}
catch(err){
return null;
}
})
console.log('rinds ', rings)
return union(rings.filter(r=>r))
}
function makeYearRing(yearData, radius, scaleFactor, height){
var coords = yearData.map((d,i)=> [(radius + scaleFactor*d)*Math.cos( i*2*3.141/12.0),(radius + scaleFactor*d)*Math.sin( i*2*3.141/12.0)] ) ;
coords.push(coords[0]);
console.log(coords);
var ring = new CAG.fromPoints(coords);
return linear_extrude({height:height},ring);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment