John Tauxe's Programming Bits

A collection of potentially useful bits of computer programming stuff, including C, Java, and other stuff. 
Since most of this work was supported in some way by the public, I figure you're entitled to it as freeware. 
I would appreciate, however your reporting of any bugs, or better yet, reporting of successful applications! 

C Bits

Here's some code for performing a variety of geometric transformations between different coordinate systems: geographic (degrees clockwise from north), cartesian, polar, and meterological (the geographic direction that the wind comes FROM), plus a routine for calculating the euclidean distance between two points. 

geometry.c and its header file geometry.h 

You've heard of atod, which converts an "ASCII" text string to a double-precision floating point value. But did you ever want to go the other way? This little gem converts a double to a text string, given constraints about string length, and whether to use scientific notation. This was developed for the purpose of constructing strings that are numeric axis values for a graph. Depending on the amount of space (the number of characters) to work with and the type of notations needed (scientific or decimal) a suitable string is produced. 

dtoa.c 

Java Bits

Code for sorting by two algorithms, Shell's method and the heap sort method: Sorter.java, and a test code to prove that these really work: SortTest.java. By the way, I have used heap sort to sort arrays of over 200,000 records! 

Code for calculating the mean of an array of geographic directions: DirMeanTest.java, including some testing to prove that it works right. 

SunCalc is an applet that calculates the time of sunrise and sunset for any location on earth. This applet is based on three pieces of Java code:

  • SunCalc.java is the interface,
  • LatLonConvert.java handles the latitude and longitude conversions between decimal degrees and minutes/degrees/seconds, which is in itself a useful class, and
  • SunriseSunset.java, the calculational engine, based on the BASIC program SUNUP.BAS by Sinnott (1994).

Reference: Sinnott, Roger W. Sunrise and Sunset: A Challenge, Sky & Telescope, August, 1994 p.84-85 

Windows Programming Bits

The ShowFlow Windows applicaton is a graphical user interface for groundwater models. It is designed as a front end for existing DOS-based models, and runs as a Multiple Document Interface (MDI) program under Microsoft Windows 3.1x, Windows95, NT, and XP.

The source code is archived in the file sf211.zip.

Visit the ShowFlow Web Page for more information. 

Miscellaneous Programming Bits

Remember the infamous Pentium floating-point flaw? Test your system using the PENTIUMX program (written in C), archived in this zip file: pentiumx.zip