climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1562259 - /incubator/climate/trunk/ocw-ui/backend/find_latlon_var.py
Date Tue, 28 Jan 2014 22:18:54 GMT
Author: joyce
Date: Tue Jan 28 22:18:54 2014
New Revision: 1562259

URL: http://svn.apache.org/r1562259
Log:
CLIMATE-326 - Clean up find_latlon_var

- Update docstring to be more correct and remove unneeded data.
- Remove print statements and commented out code statements.

Modified:
    incubator/climate/trunk/ocw-ui/backend/find_latlon_var.py

Modified: incubator/climate/trunk/ocw-ui/backend/find_latlon_var.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw-ui/backend/find_latlon_var.py?rev=1562259&r1=1562258&r2=1562259&view=diff
==============================================================================
--- incubator/climate/trunk/ocw-ui/backend/find_latlon_var.py (original)
+++ incubator/climate/trunk/ocw-ui/backend/find_latlon_var.py Tue Jan 28 22:18:54 2014
@@ -14,26 +14,23 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 #
-#!/usr/local/bin/python
+
 """
-    Small command line utility to find what the latitude and longitude variables are called
in a model file.
+    Find the latitude and longitude variables contained in a model file.
 
-    Background::  
+    Background: 
         Model output files tend not to follow any defined standard in terms of 
         variable naming conventions.  One model may call the latitude "lat", 
         another one may call it "Latitudes".  This script looks for the 
         existence of any of a predefined list of synonyms for lat and long.
 
-    This script should be run from the command line (i.e. not called from 
-    within python)
-
-    Input::
+    Input:
         -filename
     
-    Output::
+    Output:
         -success flag (1 or 0): were both latitude and longitude variable names found in
the file?
     
-    if successful::
+    if successful:
         -name of latitude variable
         -name of longitude variable
         -latMin -descriptions of lat/lon ranges in data files
@@ -43,9 +40,6 @@
     
     if unsuccessful:
         -list of variable names in file
-    
-    (NB. all printed to standar output)
-    
 """
 
 import sys
@@ -54,8 +48,6 @@ import bottle
 from bottle import request
 import json
 
-#filename = sys.argv[1]
-
 @bottle.route('/list/latlon/:filename#".*"#')
 def find_latlon(filename):
   success = 0
@@ -77,7 +69,6 @@ def find_latlon(filename):
   # Find the intersection of two sets, i.e. find what latitude is called in this file.
   
   try:
-    print 'hello from inside try block'
     lat_var_name = list(varset & lat_possible_names)[0]
     successlat = 1
     index = 0
@@ -92,7 +83,6 @@ def find_latlon(filename):
     latMax = lats.max()
 
   except:
-    print 'exception happens'
     latname = 'not_found'
     successlat = 0
 
@@ -126,17 +116,12 @@ def find_latlon(filename):
   
   
   if success:
-    print success, latname, lonname, latMin, latMax, lonMin, lonMax
     val_types= [int,str,str,str,str,str,str]
     success_values = [success, latname, lonname, latMin, latMax, lonMin, lonMax]
     value_names = ['success','latname','lonname','latMin','latMax','lonMin','lonMax']
     values = [vtypes(svalues) for vtypes,svalues in zip(val_types,success_values)]
-    print values
     output = dict(zip(value_names,values))
-    #json_output = json.dumps({'success':success,'latname':latname, \
-    #                          'lonname':lonname,'latMin':latMin, \
-    #                           'latMax':latMax,'lonMin':lonMin, \
-    #                           'lonMax':lonMax }, sort_keys=True, indent=4)
+
     if (request.query.callback):
       return "%s(%s)" % (request.query.callback, output)
     return output
@@ -148,5 +133,3 @@ def find_latlon(filename):
     if (request.query.callback):
       return "%s(%s)" % (request.query.callback, json_output)
     return json_output
-    #print success, var_name_list
-



Mime
View raw message