Changeset 7041


Ignore:
Timestamp:
May 15, 2009, 8:27:16 AM (15 years ago)
Author:
rwilson
Message:

Fixed bug in 'gridding' operation if no list generated.

Location:
misc/tools/event_selection
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • misc/tools/event_selection/EventSelection.py

    r6366 r7041  
    1414import tempfile
    1515try:
    16     import cpickle
     16    import cpickle as pickle
    1717except:
    1818    import pickle
     
    5353# program name and version
    5454APP_NAME = 'EventSelection'
    55 APP_VERSION = '1.0'
     55APP_VERSION = '1.1'
    5656
    5757# name of the configuration filename
     
    536536                          size=(CTL_WIDTH, CTL_HEIGHT), style=wx.ALIGN_RIGHT)
    537537            self.txtQuakeID = wx.TextCtrl(p, -1, size=(100, 20),
    538                                           pos=(GEN_TEXTXOFFSET, Y_OFFSET))
     538                                          pos=(GEN_TEXTXOFFSET, Y_OFFSET),
     539                                          style=wx.TE_READONLY)
    539540            Y_OFFSET += GEN_DELTAY
    540541            x = FORM_WIDTH/2 - BUTTON_WIDTH - DOUBLE_BUTTON_OFFSET
     
    890891                filenames.append(filename)
    891892               
    892 ## No longer generate the python data file
    893 ##            # write data to the file
    894 ##            urs_filename = '%s/%s' % (ResultSubdir, URSDataFilename % quake_ID)
    895 ##            try:
    896 ##                out_fd = open(urs_filename, "w")
    897 ##            except IOError, msg:
    898 ##                self.error("Error opening output file %s': %s" %
    899 ##                           (urs_filename, msg))
    900 ##                return
    901 ##            if last_weight and filenames:
    902 ##                out_fd.write('# Data for region %s,\n'
    903 ##                             '#          hazard %d,\n'
    904 ##                             '#          min height %.2f,\n'
    905 ##                             '#          max height %.2f,\n'
    906 ##                             '#          quake ID %d\n' %
    907 ##                             (Region, GaugeNumber, MinimumHeight,
    908 ##                              MaximumHeight, quake_ID))
    909 ##                out_fd.write('# Generated on %s.\n' % time.asctime(time.localtime()))
    910 ##                out_fd.write('\n')
    911 ##                out_fd.write('import os.path\n')
    912 ##                out_fd.write('\n')
    913 ##                out_fd.write('def getInfo(base_directory):\n')
    914 ##                out_fd.write('    """\n')
    915 ##                out_fd.write('    Return the weight factor and list of URS data filenames\n')
    916 ##                out_fd.write('\n')
    917 ##                out_fd.write('        (weight_factor, [filenames]) <- get_urs_data(base_directory)\n')
    918 ##                out_fd.write('\n')
    919 ##                out_fd.write('    where base_directory is the path to the mux files.\n')
    920 ##                out_fd.write('    """\n')
    921 ##                out_fd.write('\n')
    922 ##                out_fd.write('    weight_factor = %f\n' % last_weight)
    923 ##                out_fd.write('    mux_filenames = [')
    924 ##                if filenames:
    925 ##                    for fn in filenames[:-1]:
    926 ##                        out_fd.write('"%%s" %% os.path.join(base_directory, "%s"),\n                     ' % fn)
    927 ##                    out_fd.write('"%%s" %% os.path.join(base_directory, "%s")\n                    ' % filenames[-1])
    928 ##                out_fd.write(']\n')
    929 ##                out_fd.write('\n')
    930 ##                out_fd.write('    return (weight_factor, mux_filenames)\n')
    931 ##            out_fd.close()
    932            
    933893        ######
    934894        # Call the get_grid function.
     
    938898            quake_ID = self.txtQuakeID.GetValue()
    939899            if len(quake_ID) == 0:
    940                 self.error('You must enter a quake ID first')
    941                 return
    942             try:
    943                 quake_ID = int(quake_ID)
    944             except:
    945                 self.error("You must enter a Quake ID")
    946                 return
     900                self.error("You must enter a quake ID by clicking in "
     901                           "the 'list' result box")
     902                return
     903            quake_ID = int(quake_ID)
    947904
    948905            region_select = self.cbRegion.GetValue()
     
    962919            multimux_dir = os.path.join(BaseDirectory, region_dir_name, 'multimux')
    963920            grid_dir = os.path.join(BaseDirectory, region_dir_name, 'static_2m')
     921
     922            # check that the sub-directory has been created
     923            if ResultSubdir == '' or not os.path.isdir(ResultSubdir):
     924                self.error("Sorry, you must 'list' earthquakes first.")
     925                return
    964926
    965927            ####################################################################
     
    10481010            out_fd.write('WEIGHT_FACTOR=%f\n' % weight_factor)
    10491011            out_fd.write('DATA_PATH=%s\n' % grid_dir)
    1050             for fn in filenames[1:]:
     1012            #for fn in filenames[1:]:
     1013            for fn in filenames:
    10511014                owning_dir = filenames[0].split('-')[0]
    10521015                out_fd.write('GRID=%s\n' % (os.path.join(owning_dir, fn)))
  • misc/tools/event_selection/installer/EventSelection.nsi

    r6364 r7041  
    11!define PRODUCT_NAME "EventSelection"
    2 !define PRODUCT_VERSION "1.0"
     2!define PRODUCT_VERSION "1.1"
    33!define ICON_FILE "tsunami.ico"
    44
Note: See TracChangeset for help on using the changeset viewer.