From 1ab9cb25cedb1d8a1ab131edf558eec98ec168f0 Mon Sep 17 00:00:00 2001
From: Eva Schiffer <evas@ssec.wisc.edu>
Date: Tue, 23 Nov 2021 10:18:07 -0600
Subject: [PATCH] better selection of default nav variables in the GUI

---
 pyglance/glance/gui_constants.py |  4 ++--
 pyglance/glance/gui_model.py     | 10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/pyglance/glance/gui_constants.py b/pyglance/glance/gui_constants.py
index e106516..ce553fc 100644
--- a/pyglance/glance/gui_constants.py
+++ b/pyglance/glance/gui_constants.py
@@ -69,8 +69,8 @@ DATA_FORMS = [SIMPLE_2D,
               ONLY_1D]
 
 # the default names that the model will try to select for the latitude and longitude
-DEFAULT_LONGITUDE = 'pixel_longitude'
-DEFAULT_LATITUDE  = 'pixel_latitude'
+DEFAULT_LONGITUDES = ['pixel_longitude', 'longitude', 'Longitude',]
+DEFAULT_LATITUDES  = ['pixel_latitude',  'latitude',  'Latitude',]
 
 # the number of bins to use for histograms
 DEFAULT_NUM_BINS = 50
diff --git a/pyglance/glance/gui_model.py b/pyglance/glance/gui_model.py
index 8146e60..925d46d 100644
--- a/pyglance/glance/gui_model.py
+++ b/pyglance/glance/gui_model.py
@@ -242,10 +242,12 @@ class GlanceGUIModel (object) :
                 # set the longitude and latitude names, using the defaults if they exist
                 self.fileData[filePrefix].latitude      = tempVariable
                 self.fileData[filePrefix].longitude     = tempVariable
-                if DEFAULT_LATITUDE  in variableList :
-                    self.fileData[filePrefix].latitude  = DEFAULT_LATITUDE
-                if DEFAULT_LONGITUDE in variableList :
-                    self.fileData[filePrefix].longitude = DEFAULT_LONGITUDE
+                for temp_lat_name in DEFAULT_LATITUDES :
+                    if temp_lat_name  in variableList :
+                        self.fileData[filePrefix].latitude  = temp_lat_name
+                for temp_lon_name in DEFAULT_LONGITUDES :
+                    if temp_lon_name in variableList :
+                        self.fileData[filePrefix].longitude = temp_lon_name
 
                 # make sure the longitude and latitude are loaded into our local cache
                 # TODO, it would be good to background this task at some point
-- 
GitLab