zkwurst / GSoC2017-GRASS-GIS

GNU General Public License v2.0
2 stars 1 forks source link

USGS_product_dict: General #3

Closed zkwurst closed 7 years ago

zkwurst commented 7 years ago

Any issues with this dictionary format? I can see difficulties populating the GUI options dynamically for different datasets that have different parameters.

   USGS_product_dict = [{"product": 
            {"NED": 
                {"title": "National Elevation Dataset (NED)", 
                 "format": "IMG", 
                 # Need to work on dynamic 'file_string' formatting
                 # Currently hardcoded for NED format around line 237
                 "file_string": "'img{0}_13.img'",
                 "resolution": {"1 arc-second": "1 x 1 degree", 
                                "1/3 arc-second": "1 x 1 degree", 
                                "1/9 arc-second": "15 x 15 minute"
                                },
                 "srs": "nad83",
                 "srs_proj4": "+proj=longlat +ellps=GRS80 +datum=NAD83 +nodefs"
                 }}}]

    # Dynamic variables called from USGS data dict
    nav_string = USGS_product_dict[0]["product"][gui_product]
    product_title = nav_string["title"]
    product_format = nav_string["format"]
    product_format_string = nav_string["file_string"]
    product_extents = nav_string["resolution"][gui_resolution]
    product_srs = nav_string["srs"]
    product_proj4 = nav_string["srs_proj4"]
petrasovaa commented 7 years ago

Seems unnecessary nested. Why not:

{'NED': 
   {'title':...,
    'format': ...,
    ...
    },
 'NLCD': {...       
}

But maybe I am missing something...

zkwurst commented 7 years ago

Nope. You're right. No need to have it that way.