Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions DEVNOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cd pythonprop/src
ipython
import sys
from pythonprop import voacapgui
voacapgui.main(sys.argv, datadir='/usr/local/share/pythonprop')

38 changes: 21 additions & 17 deletions src/pythonprop/voaAreaPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# 02110-1301, USA.
#

import ipdb
import argparse
import datetime
import gettext
Expand Down Expand Up @@ -129,7 +130,7 @@ def __init__(self, in_file,
if len(points_of_interest) > 0:
self.points_of_interest.extend(points_of_interest)
"""

imageBuf = np.zeros([img_grid_size, img_grid_size], float)

area_rect = plot_parameters.get_area_rect()
Expand Down Expand Up @@ -203,19 +204,22 @@ def __init__(self, in_file,
cbar_pad=0.2,
cbar_size='3%',
label_mode='')

self.main_title_label = fig.suptitle(str(self.image_defs['title']), fontsize=self.main_title_fontsize)



#for plot_idx, vg_file in enumerate(vg_files):
for plot_idx, ax, vg_file in zip(range(number_of_subplots), axgr, vg_files):

points = np.zeros([img_grid_size,img_grid_size], float)

lons = np.arange(area_rect.get_sw_lon(), area_rect.get_ne_lon()+0.001,(area_rect.get_ne_lon()-area_rect.get_sw_lon())/float(img_grid_size-1))
ipdb.set_trace()
area_diff = (area_rect.get_ne_lon()-area_rect.get_sw_lon()) + 0.001
lons = np.arange(area_rect.get_sw_lon(), area_rect.get_ne_lon()+0.001, area_diff/float(img_grid_size-1))
lons[-1] = min(180.0, lons[-1])
lats = np.arange(area_rect.get_sw_lat(), area_rect.get_ne_lat()+0.001,(area_rect.get_ne_lat()-area_rect.get_sw_lat())/float(img_grid_size-1))
area_diff = (area_rect.get_ne_lat()-area_rect.get_sw_lat()) + 0.001
lats = np.arange(area_rect.get_sw_lat(), area_rect.get_ne_lat()+0.001, area_diff/float(img_grid_size-1))
lats[-1] = min(90.0, lats[-1])

#ax.label_outer()
Expand All @@ -238,12 +242,12 @@ def __init__(self, in_file,
vgFile.close()
if 'zf' in locals():
zf.close()

ax.set_extent([area_rect.get_sw_lon(),
area_rect.get_ne_lon(),
area_rect.get_sw_lat(),
area_rect.get_ne_lat()], projection)

ax.coastlines()

lons, lats = np.meshgrid(lons, lats)
Expand All @@ -269,7 +273,7 @@ def __init__(self, in_file,
vmin=self.image_defs['min'],
vmax=self.image_defs['max'],
transform=projection)

if plot_nightshade:
self.fill_dark_side(ax,
time=plot_parameters.get_daynight_datetime(vg_files[plot_idx]-1),
Expand Down Expand Up @@ -325,18 +329,18 @@ def __init__(self, in_file,
title_str = plot_parameters.get_minimal_plot_description_string(vg_files[plot_idx]-1, self.image_defs['plot_type'], time_zone=time_zone)
self.subplot_title_label = ax.set_title(title_str)

# Hide any unused subplots
# Hide any unused subplots
for ax in axgr[number_of_subplots:]:
ax.set_visible(False)

axgr.cbar_axes[0].colorbar(im,
ticks = self.image_defs['y_labels'],
format = mticker.FuncFormatter(eval('self.'+self.image_defs['formatter'])))

if save_file :
plt.savefig(save_file,
dpi=self.dpi,
facecolor=fig.get_facecolor(),
plt.savefig(save_file,
dpi=self.dpi,
facecolor=fig.get_facecolor(),
edgecolor='none')

#todo this ought to a command line param
Expand Down Expand Up @@ -459,7 +463,7 @@ def main(in_file, datadir=None):
parser = argparse.ArgumentParser(description="Plot voacap area data")
parser.add_argument("in_file",
help = _("Path to the .voa file. This should be in the same directory as the associated .vgx files."))

parser.add_argument("-c", "--contours",
dest = "plot_contours",
action = "store_true",
Expand All @@ -482,7 +486,7 @@ def main(in_file, datadir=None):
action="store_true",
default=False,
help=_("Plot meridians."))

parser.add_argument("-k", "--background",
dest="face_colour",
default='white',
Expand Down Expand Up @@ -600,7 +604,7 @@ def main(in_file, datadir=None):
except:
print(_("Error reading vg files, resetting to '1'"))
vg_files = [1]

if args.timezone:
time_zone = int(args.timezone)
if time_zone > 12: time_zone = 0
Expand Down
4 changes: 4 additions & 0 deletions src/pythonprop/voaFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ def parse_file(self):
elif line.startswith("Gridsize"):
self.gridsize = int(line[11:16])
if DEBUG: print("Gridsize = ", self.gridsize)
if self.gridsize < 2:
msg = "Grid size parsed is less than 2 resulting in div by zero."
msg += "\nInput file: {}".format(self.filename)
raise Exception(msg)
if int(line[19:20]) in PROJECTION:
self.projection = PROJECTION[int(line[19:20])]
if DEBUG: print("Projection = ", self.projection)
Expand Down
4 changes: 3 additions & 1 deletion src/pythonprop/voacapgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
gettext.textdomain(GETTEXT_DOMAIN)


from os import path

from .voaTextFileViewDialog import VOATextFileViewDialog
from .voaDatFile import *
from .voaDefaults import *
Expand All @@ -101,7 +103,7 @@ class VOACAP_GUI():
itshfbc_path = 'C:\itshfbc'
prefs_dir = 'C:\itshfbc\database\\'
else:
itshfbc_path = os.path.expanduser("~")+os.sep+'itshfbc'
itshfbc_path = path.join(os.path.expanduser("~"), 'itshfbc')
prefs_dir = os.path.expanduser("~")+os.sep+'.voacapgui'+os.sep


Expand Down