Curtis L. Olson writes:
> 
> Jon Stockill writes:
> > On Thu, 28 Aug 2003, Curtis L. Olson wrote:
> > 
> > > Actually you will want to run terrafit.py ... it will recurse through
> > > the specified directory and produce .fit files for any .arr files it
> > > finds.
> > 
> > I'd already overcome that problem with a combination of "for" and "find"
> > to make arrayfit process it all, but terrafit.py seems like a much nicer
> > solution :-)
> 
> I don't know enough python to pull this off (and don't have time to
> investigate it right now anyway) but it would be handy perhaps to make
> terrafit.py check if the .fit file is newer than the .arr file and
> if so skip it (kind of like the make utility.)

Hmm.. this is easy enough todo

Note this patch includes my earlier fix for paramater passing

HTH

Norman

$ cvs diff -u terrafit.py
Index: terrafit.py
===================================================================
RCS file: /var/cvs/TerraGear-0.0/TerraGear/src/Prep/TerraFit/terrafit.py,v
retrieving revision 1.4
diff -u -r1.4 terrafit.py
--- terrafit.py 19 Aug 2003 02:27:08 -0000      1.4
+++ terrafit.py 28 Aug 2003 14:16:56 -0000
@@ -106,6 +106,18 @@
         raise IOError, (2, 'No such file or directory: ' + fname)
         return

+    # need to do this twice to get basename 'XXX.arr.gz'
+    basename,ext = os.path.splitext(fname)
+    basename,ext = os.path.splitext(basename)
+    gzName = basename+".fit.gz"
+
+    try:
+        if path.getmtime(gzName) > path.getmtime(fname):
+            print "Skipping: %s is newer then %s"%(gzName,fname)
+            return
+    except:
+        pass
+
     gzin = GzipFile(fname, 'rb')

     data = gzin.readline()
@@ -130,17 +142,12 @@
         max_z   = max(max_z,max(data[i]))
         min_z   = min(min_z,min(data[i]))

-    # need to do this twice to get basename 'XXX.arr.gz'
-    basename,ext = os.path.splitext(fname)
-    basename,ext = os.path.splitext(basename)
-
     pgmName = basename+'.pgm'
     pre_terra(pgmName, data, span_x, span_y, max_z, min_z)

     objName = basename+'.obj'
     npts = run_terra(thresh, minnodes, count, factor, objName, pgmName)

-    gzName = basename+".fit.gz"
     post_terra(objName, gzName, step_x, step_y, min_x, min_y, min_z)

     if CLEAN_TEMP_FILES:
@@ -209,9 +216,9 @@
             sys.stderr.write('%s version %s\n' % (sys.argv[0],VERSION,))
             sys.exit(0)
         if o in ('--minnodes','-m'): minnodes = string.atoi(v)
-        if o == ('--maxnodes','-x'): maxnodes = string.atoi(v)
-        if o == ('--maxerror','-e'): maxerror = string.atof(v)
-        if o == ('--factor','-f'): factor = string.atof(v)
+        if o in ('--maxnodes','-x'): maxnodes = string.atoi(v)
+        if o in ('--maxerror','-e'): maxerror = string.atof(v)
+        if o in ('--factor','-f'): factor = string.atof(v)
     if len(args) == 0 and len(opts) == 0:
         usage()
         sys.exit(1)


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to