I said I’d post an updated version with labels and heading, and minus the gratuitous white border you get by default. Well, here it is:
I’m now using IDLE so that I can save the text of programs between runs and not need to restart my environment via relaunching the python interpreter each time. The debian command idle3 launches a ‘terminal window’ that is “special”. It has syntax checkers, auto indents, a ‘run’ menu item (run module to run what is currently being written) and a save / save as menu choice. Also open for pulling in the existing programs. There’s LOTS of other choices too, but that’s the minimum that got me going. Things like “open module” and “comment out region”. When you chose “run module” it pops open a Python shell window, runs the code, and error messages are displayed there. Repeated runs add to the history in that window.
I’ve made a specific directory for it to work in and where I’m saving my Python programs:
chiefio@odroidxu4:~/Py$ ls abase.py My2nd.py MyFirst.py SineDotLabels.py
abase.py is my starting base full of the standard set up stuff and some model code. I can then delete what isn’t needed and add what is, while not needing to retype a lot of boilerplate stuff. Sine means the sine projection, dot is the dots, and labels tells me it has labels in it. ;-)
Here’s the program in total (it includes some gratuitous “import FOO” lines from the base skeleton that I can suck in that just has all the ‘set up’ stuff in it already. I suppose I ought to remove them, but…):
chiefio@odroidxu4:~/Py$ cat SineDotLabels.py import datetime import pandas as pd import numpy as np import matplotlib.pylab as plt import math df = pd.read_csv('../SQL/v3/invent.csv') plt.title("Global Thermometer GHCN v3.3") plt.xlabel("Longitude") plt.ylabel("Latitude") plt.xlim(-180,180) plt.ylim(-90,90) PLON=df["LON"]*np.cos(np.radians(df["LAT"])) plt.scatter(PLON, df["LAT"],s=1) plt.show()
Note that since the .py programs are being stored in a ~/Py directory, the path name for the file to use to suck in the data has changed to ../SQL/… I suppose I ought to eventually set up some place like /SQL or whatever and make that an absolute path (so it would work wherever launched) but can’t do everything at once…
Next steps will be moving to direct use of the MySQL database along with making 2 more graphs. One with baseline thermometers, the other with current. At least, that’s the work plan for the rest of the day. As I get bits done I’ll post an update here with the graphs.
The good news is that with IDLE this is going much faster, and also faster as I learn more bits of the code (and as it gets stuck in the brain in cache ;-) Spending part of the day making your environment work better is a Very Good Thing, but having a reason to do so because you have actually made a graph or bit of code is also a Very Good Thing. ;-) So for now at least, I’m a happy camper ;-)
Here’s the graph made from the database data directly. Not yet in sine globe shape, but I’ve got the database stuff working now!
And here’s a Sine perspective globe with data from the database. I “kind of cheated” in that I compute the cos(latitude) in the FORTRAN db load file program, but I figured since I’m going to do it a lot, better to just compute it once and store it in the DB. Sometime later I’ll figure out how to do that in Python (as a Python data load prep program) and in SQL inside the MySQL program. Just so I know all the options and can use them later if needed for something else. With that, here’s your graph:
It ought to look just like the ones done from the CSV file load, so not a lot of visual spice here; just a statement of an accomplishment. Another checklist item of progress ticked off.
This is a graph of only those stations that had reported data in the last year of the V3.3 dataset I have. It looks a bit “moth eaten” but this is what is making the “now” temperature value compared to baseline.
Here’s the more or less GIStemp baseline graph:
After discovering that the “present in the last year of the dataset – the ‘now'” was almost identical to the “now” set (only 3 stations missing) I decided to turn it around. Here’s the map of what IS in the baseline but is MISSING from the present. So these stations set the temperature in the past, to which a DIFFERENT set of stations are compared in the present.
Oh this is a fun one. I’ve put both the baseline and the “now” stations on the same map, but those only NOW are red ( 1/2 transparency) while those only in the baseline are blue (full color density). This means a red on top of a blue will give a purple, but a whole lot of reds will tend to hide the blue, and out in the boonies you can see the light red vs the blue as what was dropped vs kept.
Then, since the RED tends to swamp the blue where there’s a lot of thermometers now, I’ve also made one with red first, then blue as 50% transparent over it.