Changeset 862

Show
Ignore:
Timestamp:
12/12/11 17:20:25 (17 months ago)
Author:
jjr8
Message:

Continuing work on NOAA OSCAR. Also added HYCOM GLBa0.08 to connectivity tool.

Location:
MGET/Branches/Jason/PythonPackage/src/GeoEco
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • MGET/Branches/Jason/PythonPackage/src/GeoEco/Connectivity/CoralReefConnectivity.py

    r788 r862  
    2222 
    2323from GeoEco.DataProducts.Aviso import AvisoGriddedGeostrophicCurrents, _AvisoGriddedProduct_LongDescription 
    24 from GeoEco.DataProducts.HYCOM import HYCOMGOMl0044D, _HYCOMGOMl004_LongDescription 
     24from GeoEco.DataProducts.HYCOM import HYCOMGOMl0044D, _HYCOMGOMl004_LongDescription, HYCOMGLBa008Equatorial4D, _HYCOMGLBa008Equatorial_LongDescription 
     25from GeoEco.DataProducts.NOAA.OSCAR import OSCAR5DayThirdDegreeCurrents, _OSCAR_LongDescription 
    2526from GeoEco.DynamicDocString import DynamicDocString 
    2627from GeoEco.Internationalization import _ 
     
    184185 
    185186        avisoCurrentsDirectory = os.path.join(simulationDirectory, 'OriginalAvisoCurrents') 
     187        AvisoGriddedGeostrophicCurrents.CreateArcGISRasters(username, password, product, u'u', avisoCurrentsDirectory, rasterNameExpressions=['u', '%%Y', 'u%%Y%%j0000.img'], startDate=startDate, endDate=endDate, timeout=timeout, maxRetryTime=maxRetryTime, cacheDirectory=cacheDirectory) 
     188        AvisoGriddedGeostrophicCurrents.CreateArcGISRasters(username, password, product, u'v', avisoCurrentsDirectory, rasterNameExpressions=['v', '%%Y', 'v%%Y%%j0000.img'], startDate=startDate, endDate=endDate, timeout=timeout, maxRetryTime=maxRetryTime, cacheDirectory=cacheDirectory) 
     189 
     190        # Record in the Simulation.ini file that we downloaded some 
     191        # currents and then project, snap, and clip them to the 
     192        # projection, extent, and cell size of the reef IDs raster. 
     193 
     194        cls._FinishLoadingCurrents(simulationDirectory, u'Aviso ' + product, u'Center', 86400, avisoCurrentsDirectory, u'setnull( inputRaster > 1000000 || inputRaster < -1000000, inputRaster / 100)')     # Use Map Algebra to Convert from cm/s to to m/s and mask bogus values introduced by ArcGIS 
     195 
     196        # Return successfully. 
     197 
     198        return simulationDirectory 
     199 
     200    @classmethod 
     201    def LoadOSCARCurrentsIntoSimulation(cls, simulationDirectory, startDate, endDate, timeout=60, maxRetryTime=120, cacheDirectory=None): 
     202        cls.__doc__.Obj.ValidateMethodInvocation() 
     203 
     204        # Parse and validate the Simulation.ini file. 
     205 
     206        scp, crosses180, currentsLoaded, currentsProduct = cls._ReadCurrentsInfoFromSimulationINI(simulationDirectory) 
     207 
     208        # If the simulation already has currents loaded in it from a 
     209        # different product, report an error. 
     210 
     211        if currentsLoaded and currentsProduct != u'OSCAR': 
     212            Logger.RaiseException(ValueError(_(u'Cannot load OSCAR currents data into the simulation in directory %(dir)s because that simulation already has %(prod2)s currents data loaded into it. You can load additional %(prod2)s data, if you like, but to use OSCAR data, you must create a new simulation.') % {u'dir': simulationDirectory, u'prod2': currentsProduct})) 
     213 
     214        # First, download and create OSCAR current rasters in an 
     215        # OSCAR-specific directory. These will have the OSCAR 
     216        # projection, extent, and cell size. We still need to project 
     217        # them to the simulation's projection, extent, and cell size. 
     218        # 
     219        # TODO: Need to handle rotation? 
     220 
     221        oscarCurrentsDirectory = os.path.join(simulationDirectory, 'OriginalOSCARCurrents') 
     222        OSCAR5DayThirdDegreeCurrents.CreateArcGISRasters(u'u', oscarCurrentsDirectory, rasterNameExpressions=['u', '%%Y', 'u%%Y%%j0000.img'], startDate=startDate, endDate=endDate, timeout=timeout, maxRetryTime=maxRetryTime, cacheDirectory=cacheDirectory) 
     223        OSCAR5DayThirdDegreeCurrents.CreateArcGISRasters(u'v', oscarCurrentsDirectory, rasterNameExpressions=['v', '%%Y', 'v%%Y%%j0000.img'], startDate=startDate, endDate=endDate, timeout=timeout, maxRetryTime=maxRetryTime, cacheDirectory=cacheDirectory) 
     224 
     225        # Record in the Simulation.ini file that we downloaded some 
     226        # currents and then project, snap, and clip them to the 
     227        # projection, extent, and cell size of the reef IDs raster. 
     228 
     229        cls._FinishLoadingCurrents(simulationDirectory, u'OSCAR', u'Center', 6*86400, oscarCurrentsDirectory) 
     230 
     231        # Return successfully. 
     232 
     233        return simulationDirectory 
     234 
     235    @classmethod 
     236    def LoadHYCOMGOMl0044DCurrentsIntoSimulation(cls, simulationDirectory, startDate, endDate, depth=0., timeout=600, maxRetryTime=None, cacheDirectory=None): 
     237        cls.__doc__.Obj.ValidateMethodInvocation() 
     238 
     239        # Parse and validate the Simulation.ini file. 
     240 
     241        scp, crosses180, currentsLoaded, currentsProduct = cls._ReadCurrentsInfoFromSimulationINI(simulationDirectory) 
     242 
     243        # If the simulation already has currents loaded in it from a 
     244        # different product or depth, report an error. 
     245 
     246        if currentsLoaded and currentsProduct != u'HYCOM GOMl0.04 ' + unicode(int(depth)) + u' m': 
     247            Logger.RaiseException(ValueError(_(u'Cannot load %(prod1)s currents data into the simulation in directory %(dir)s because that simulation already has %(prod2)s currents data loaded into it. You can load additional %(prod2)s data, if you like, but to use %(prod1)s data, you must create a new simulation.') % {u'dir': simulationDirectory, u'prod1': u'HYCOM GOMl0.04 ' + unicode(int(depth)) + u' m', u'prod2': currentsProduct})) 
     248 
     249        # First, download and create HYCOM current rasters in a 
     250        # HYCOM-specific directory. These will have the HYCOM 
     251        # projection, extent, and cell size. We still need to project 
     252        # them to the simulation's projection, extent, and cell size. 
     253 
     254        hycomCurrentsDirectory = os.path.join(simulationDirectory, 'OriginalHYCOMCurrents') 
     255        HYCOMGOMl0044D.CreateArcGISRasters(u'u', hycomCurrentsDirectory, rasterNameExpressions=['%(VariableName)s', '%%Y', '%(VariableName)s%%Y%%j0000.img'], minDepth=depth, maxDepth=depth, startDate=startDate, endDate=endDate, timeout=timeout, maxRetryTime=maxRetryTime, cacheDirectory=cacheDirectory) 
     256        HYCOMGOMl0044D.CreateArcGISRasters(u'v', hycomCurrentsDirectory, rasterNameExpressions=['%(VariableName)s', '%%Y', '%(VariableName)s%%Y%%j0000.img'], minDepth=depth, maxDepth=depth, startDate=startDate, endDate=endDate, timeout=timeout, maxRetryTime=maxRetryTime, cacheDirectory=cacheDirectory) 
     257 
     258        # Record in the Simulation.ini file that we downloaded some 
     259        # currents and then project, snap, and clip them to the 
     260        # projection, extent, and cell size of the reef IDs raster. 
     261 
     262        cls._FinishLoadingCurrents(simulationDirectory, u'HYCOM GOMl0.04  ' + unicode(int(depth)) + u' m', u'Center', 86400, hycomCurrentsDirectory) 
     263 
     264        # Return successfully. 
     265 
     266        return simulationDirectory 
     267 
     268    @classmethod 
     269    def LoadHYCOMGLBa0084DEquatorialCurrentsIntoSimulation(cls, simulationDirectory, startDate, endDate, depth=0., extendYExtent=False, timeout=60, maxRetryTime=120, cacheDirectory=None): 
     270        cls.__doc__.Obj.ValidateMethodInvocation() 
     271 
     272        # Parse and validate the Simulation.ini file. 
     273 
     274        scp, crosses180, currentsLoaded, currentsProduct = cls._ReadCurrentsInfoFromSimulationINI(simulationDirectory) 
     275 
     276        # If the simulation already has currents loaded in it from a 
     277        # different product or depth, report an error. 
     278 
     279        if currentsLoaded and currentsProduct != u'HYCOM GLBa0.08 Equatorial ' + unicode(int(depth)) + u' m': 
     280            Logger.RaiseException(ValueError(_(u'Cannot load %(prod1)s currents data into the simulation in directory %(dir)s because that simulation already has %(prod2)s currents data loaded into it. You can load additional %(prod2)s data, if you like, but to use %(prod1)s data, you must create a new simulation.') % {u'dir': simulationDirectory, u'prod1': u'HYCOM GLBa0.08 Equatorial ' + unicode(int(depth)) + u' m', u'prod2': currentsProduct})) 
     281 
     282        # First, download and create HYCOM current rasters in a 
     283        # HYCOM-specific directory. These will have the HYCOM 
     284        # projection, extent, and cell size. We still need to project 
     285        # them to the simulation's projection, extent, and cell size. 
     286 
     287        hycomCurrentsDirectory = os.path.join(simulationDirectory, 'OriginalHYCOMCurrents') 
     288        HYCOMGLBa008Equatorial4D.CreateArcGISRasters(u'u', hycomCurrentsDirectory, rasterNameExpressions=['%(VariableName)s', '%%Y', '%(VariableName)s%%Y%%j0000.img'], extendYExtent=extendYExtent, minDepth=depth, maxDepth=depth, startDate=startDate, endDate=endDate, timeout=timeout, maxRetryTime=maxRetryTime, cacheDirectory=cacheDirectory) 
     289        HYCOMGLBa008Equatorial4D.CreateArcGISRasters(u'v', hycomCurrentsDirectory, rasterNameExpressions=['%(VariableName)s', '%%Y', '%(VariableName)s%%Y%%j0000.img'], extendYExtent=extendYExtent, minDepth=depth, maxDepth=depth, startDate=startDate, endDate=endDate, timeout=timeout, maxRetryTime=maxRetryTime, cacheDirectory=cacheDirectory) 
     290 
     291        # Record in the Simulation.ini file that we downloaded some 
     292        # currents and then project, snap, and clip them to the 
     293        # projection, extent, and cell size of the reef IDs raster. 
     294 
     295        cls._FinishLoadingCurrents(simulationDirectory, u'HYCOM GLBa0.08 Equatorial ' + unicode(int(depth)) + u' m', u'Center', 86400, hycomCurrentsDirectory) 
     296 
     297        # Return successfully. 
     298 
     299        return simulationDirectory 
     300 
     301    @classmethod 
     302    def _FinishLoadingCurrents(cls, simulationDirectory, currentsProduct, currentsDateType, maxSecondsBetweenCurrentsImages, originalCurrentsDirectory, mapAlgebraExpression=None): 
     303 
     304        # Write the Simulation.ini file, so that any new rasters 
     305        # loaded into the simulation must be from the same product and 
     306        # depth. 
     307             
     308        scp.set(u'Simulation', u'CurrentsLoaded', unicode(True)) 
     309        scp.set(u'Simulation', u'CurrentsProduct', currentsProduct) 
     310        scp.set(u'Simulation', u'CurrentsDateType', currentsDateType) 
     311        scp.set(u'Simulation', u'MaxSecondsBetweenCurrentsImages', unicode(maxSecondsBetweenCurrentsImages)) 
     312        f = file(os.path.join(simulationDirectory, u'Simulation.ini'), 'w') 
    186313        try: 
    187             AvisoGriddedGeostrophicCurrents.CreateArcGISRasters(username, password, product, u'u', avisoCurrentsDirectory, rasterNameExpressions=['u', '%%Y', 'u%%Y%%j0000.img'], startDate=startDate, endDate=endDate, timeout=timeout, maxRetryTime=maxRetryTime, cacheDirectory=cacheDirectory) 
    188             AvisoGriddedGeostrophicCurrents.CreateArcGISRasters(username, password, product, u'v', avisoCurrentsDirectory, rasterNameExpressions=['v', '%%Y', 'v%%Y%%j0000.img'], startDate=startDate, endDate=endDate, timeout=timeout, maxRetryTime=maxRetryTime, cacheDirectory=cacheDirectory) 
    189  
    190         # If we created any rasters, record in the Simulation.ini file 
    191         # that we got some, so that any new rasters loaded into the 
    192         # simulation must be from the same product and depth. 
    193              
     314            scp.write(f) 
    194315        finally: 
    195             import glob 
    196             if len(glob.glob(os.path.join(os.path.join(avisoCurrentsDirectory, u'u', u'*', u'u[0-9][0-9][0-9][0-9][0-9][0-9][0-9]0000.img')))) > 0: 
    197                 scp.set(u'Simulation', u'CurrentsLoaded', unicode(True)) 
    198                 scp.set(u'Simulation', u'CurrentsProduct', u'Aviso ' + product) 
    199                 scp.set(u'Simulation', u'CurrentsDateType', u'Center') 
    200                 if u'DT-Ref' in product or u'DT-Upd' in product: 
    201                     scp.set(u'Simulation', u'MaxSecondsBetweenCurrentsImages', unicode(7*86400)) 
    202                 else: 
    203                     scp.set(u'Simulation', u'MaxSecondsBetweenCurrentsImages', unicode(86400)) 
    204                 f = file(os.path.join(simulationDirectory, u'Simulation.ini'), 'w') 
    205                 try: 
    206                     scp.write(f) 
    207                 finally: 
    208                     try: 
    209                         f.close() 
    210                     except: 
    211                         pass 
     316            try: 
     317                f.close() 
     318            except: 
     319                pass 
    212320 
    213321        # Obtain the projection, extent, and cell size of the reef IDs 
     
    231339        gp.Extent = describeReefIDsRaster.Extent 
    232340        try: 
    233             ArcGISRaster.FindAndProjectClipAndOrExecuteMapAlgebra(avisoCurrentsDirectory, 
     341            ArcGISRaster.FindAndProjectClipAndOrExecuteMapAlgebra(originalCurrentsDirectory, 
    234342                                                                  os.path.join(simulationDirectory, u'Currents'), 
    235343                                                                  projectedCoordinateSystem=reefIDsRasterCS, 
     
    237345                                                                  projectedCellSize=reefIDsCellSize, 
    238346                                                                  registrationPoint=u'%g %g' % (reefIDsRasterLeft, reefIDsRasterBottom), 
    239                                                                   mapAlgebraExpression=u'setnull( inputRaster > 1000000 || inputRaster < -1000000, inputRaster / 100)',       # Convert from cm/s to to m/s and mask bogus values introduced by ArcGIS 
     347                                                                  mapAlgebraExpression=mapAlgebraExpression, 
    240348                                                                  wildcard=u'*.img', 
    241349                                                                  searchTree=True, 
     
    250358            if oldGPExtent is not None: 
    251359                gp.Extent = oldGPExtent 
    252  
    253         # Return successfully. 
    254  
    255         return simulationDirectory 
    256  
    257     @classmethod 
    258     def LoadHYCOMGOMl0044DCurrentsIntoSimulation(cls, simulationDirectory, startDate, endDate, depth=0., timeout=600, maxRetryTime=None, cacheDirectory=None): 
    259         cls.__doc__.Obj.ValidateMethodInvocation() 
    260  
    261         # Parse and validate the Simulation.ini file. 
    262  
    263         scp, crosses180, currentsLoaded, currentsProduct = cls._ReadCurrentsInfoFromSimulationINI(simulationDirectory) 
    264  
    265         # If the simulation already has currents loaded in it from a 
    266         # different product or depth, report an error. 
    267  
    268         if currentsLoaded and currentsProduct != u'HYCOM GOMl0.04 ' + unicode(int(depth)) + u' m': 
    269             Logger.RaiseException(ValueError(_(u'Cannot load %(prod1)s currents data into the simulation in directory %(dir)s because that simulation already has %(prod2)s currents data loaded into it. You can load additional %(prod2)s data, if you like, but to use %(prod1)s data, you must create a new simulation.') % {u'dir': simulationDirectory, u'prod1': u'HYCOM GOMl0.04 ' + unicode(int(depth)) + u' m', u'prod2': currentsProduct})) 
    270  
    271         # First, download and create HYCOM current rasters in a 
    272         # HYCOM-specific directory. These will have the HYCOM 
    273         # projection, extent, and cell size. We still need to project 
    274         # them to the simulation's projection, extent, and cell size. 
    275  
    276         hycomCurrentsDirectory = os.path.join(simulationDirectory, 'OriginalHYCOMCurrents') 
    277         try: 
    278             HYCOMGOMl0044D.CreateArcGISRasters(u'u', hycomCurrentsDirectory, rasterNameExpressions=['%(VariableName)s', '%%Y', '%(VariableName)s%%Y%%j0000.img'], minDepth=depth, maxDepth=depth, startDate=startDate, endDate=endDate, timeout=timeout, maxRetryTime=maxRetryTime, cacheDirectory=cacheDirectory) 
    279             HYCOMGOMl0044D.CreateArcGISRasters(u'v', hycomCurrentsDirectory, rasterNameExpressions=['%(VariableName)s', '%%Y', '%(VariableName)s%%Y%%j0000.img'], minDepth=depth, maxDepth=depth, startDate=startDate, endDate=endDate, timeout=timeout, maxRetryTime=maxRetryTime, cacheDirectory=cacheDirectory) 
    280  
    281         # If we created any rasters, record in the Simulation.ini file 
    282         # that we got some, so that any new rasters loaded into the 
    283         # simulation must be from the same product and depth. 
    284              
    285         finally: 
    286             import glob 
    287             if len(glob.glob(os.path.join(os.path.join(hycomCurrentsDirectory, u'u', u'*', u'u[0-9][0-9][0-9][0-9][0-9][0-9][0-9]0000.img')))) > 0: 
    288                 scp.set(u'Simulation', u'CurrentsLoaded', unicode(True)) 
    289                 scp.set(u'Simulation', u'CurrentsProduct', u'HYCOM GOMl0.04 ' + unicode(int(depth)) + u' m') 
    290                 scp.set(u'Simulation', u'CurrentsDateType', u'Center') 
    291                 scp.set(u'Simulation', u'MaxSecondsBetweenCurrentsImages', unicode(86400)) 
    292                 f = file(os.path.join(simulationDirectory, u'Simulation.ini'), 'w') 
    293                 try: 
    294                     scp.write(f) 
    295                 finally: 
    296                     try: 
    297                         f.close() 
    298                     except: 
    299                         pass 
    300  
    301         # Obtain the projection, extent, and cell size of the reef IDs 
    302         # raster, so we can project, snap, and clip the currents 
    303         # rasters to match it. 
    304  
    305         from GeoEco.ArcGIS import GeoprocessorManager 
    306         gp = GeoprocessorManager.GetWrappedGeoprocessor() 
    307  
    308         describeReefIDsRaster = gp.Describe(os.path.join(simulationDirectory, u'ReefData', u'reef_ids')) 
    309         reefIDsRasterCS = gp.CreateSpatialReference(describeReefIDsRaster.SpatialReference).split(';')[0] 
    310         reefIDsRasterLeft, reefIDsRasterBottom, reefIDsRasterRight, reefIDsRasterTop = EnvelopeTypeMetadata.ParseFromArcGISString(describeReefIDsRaster.Extent) 
    311         reefIDsCellSize = describeReefIDsRaster.MeanCellWidth 
    312  
    313         # Use a GeoEco function that calls Project_management to 
    314         # project, snap, and clip the rasters all in one step. 
    315  
    316         from GeoEco.DataManagement.ArcGISRasters import ArcGISRaster 
    317  
    318         oldGPExtent = gp.Extent 
    319         gp.Extent = describeReefIDsRaster.Extent 
    320         try: 
    321             ArcGISRaster.FindAndProjectClipAndOrExecuteMapAlgebra(hycomCurrentsDirectory, 
    322                                                                   os.path.join(simulationDirectory, u'Currents'), 
    323                                                                   projectedCoordinateSystem=reefIDsRasterCS, 
    324                                                                   resamplingTechnique=u'BILINEAR', 
    325                                                                   projectedCellSize=reefIDsCellSize, 
    326                                                                   registrationPoint=u'%g %g' % (reefIDsRasterLeft, reefIDsRasterBottom), 
    327                                                                   wildcard=u'*.img', 
    328                                                                   searchTree=True, 
    329                                                                   outputRasterPythonExpression=u'os.path.join(outputWorkspace, os.path.splitext(inputRaster[len(workspaceToSearch)+1:])[0])', 
    330                                                                   modulesToImport=[u'os'], 
    331                                                                   skipExisting=True) 
    332  
    333         # Reset the geoprocessing extent environment setting to 
    334         # whatever the caller had before. 
    335  
    336         finally: 
    337             if oldGPExtent is not None: 
    338                 gp.Extent = oldGPExtent 
    339  
    340         # Return successfully. 
    341  
    342         return simulationDirectory 
    343360 
    344361    @classmethod 
     
    10761093    arcGISDisplayName=_(u'Updated simulation directory')) 
    10771094 
     1095# Public method: CoralReefConnectivity.LoadOSCARCurrentsIntoSimulation 
     1096 
     1097AddMethodMetadata(CoralReefConnectivity.LoadOSCARCurrentsIntoSimulation, 
     1098    shortDescription=_(u'Downloads NOAA OSCAR 5-day unfiltered 1/3 degree ocean surface currents into a coral reef connectivity simulation.'), 
     1099    longDescription=_OSCAR_LongDescription % {u'name': 'tool'}, 
     1100    isExposedToPythonCallers=True, 
     1101    isExposedByCOM=True, 
     1102    isExposedAsArcGISTool=True, 
     1103    arcGISDisplayName=_(u'Load OSCAR Currents Into Coral Reef Connectivity Simulation'), 
     1104    arcGISToolCategory=_(u'Connectivity Analysis\\Coral Reef Larval Connectivity'), 
     1105    dependencies=[ArcGISDependency(9, 2), ArcGISExtensionDependency(u'spatial'), PythonAggregatedModuleDependency('numpy')]) 
     1106 
     1107CopyArgumentMetadata(CoralReefConnectivity.CreateSimulationFromArcGISRasters, u'cls', CoralReefConnectivity.LoadOSCARCurrentsIntoSimulation, u'cls') 
     1108 
     1109AddArgumentMetadata(CoralReefConnectivity.LoadOSCARCurrentsIntoSimulation, u'simulationDirectory', 
     1110    typeMetadata=DirectoryTypeMetadata(mustExist=True), 
     1111    description=_( 
     1112u"""Existing coral reef connectivity simulation directory that should 
     1113recieve the OSCAR currents data. 
     1114 
     1115The directory must have been created using the Create Coral Reef 
     1116Connectivity Simulation tool. 
     1117 
     1118If you have already loaded OSCAR currents data into the simulation, 
     1119you can use this tool to add data for an additional range of dates. If 
     1120you try to load data for a range of dates that have been already 
     1121loaded into the simulation, the downloads for those dates will be 
     1122skipped."""), 
     1123    arcGISDisplayName=_(u'Simulation directory to recieve OSCAR currents data')) 
     1124 
     1125CopyArgumentMetadata(CoralReefConnectivity.LoadAvisoGeostrophicCurrentsIntoSimulation, u'startDate', CoralReefConnectivity.LoadOSCARCurrentsIntoSimulation, u'startDate') 
     1126CopyArgumentMetadata(CoralReefConnectivity.LoadAvisoGeostrophicCurrentsIntoSimulation, u'endDate', CoralReefConnectivity.LoadOSCARCurrentsIntoSimulation, u'endDate') 
     1127CopyArgumentMetadata(OSCAR5DayThirdDegreeCurrents.CreateArcGISRasters, u'timeout', CoralReefConnectivity.LoadOSCARCurrentsIntoSimulation, u'timeout') 
     1128CopyArgumentMetadata(OSCAR5DayThirdDegreeCurrents.CreateArcGISRasters, u'maxRetryTime', CoralReefConnectivity.LoadOSCARCurrentsIntoSimulation, u'maxRetryTime') 
     1129CopyArgumentMetadata(OSCAR5DayThirdDegreeCurrents.CreateArcGISRasters, u'cacheDirectory', CoralReefConnectivity.LoadOSCARCurrentsIntoSimulation, u'cacheDirectory') 
     1130 
     1131CopyResultMetadata(CoralReefConnectivity.LoadAvisoGeostrophicCurrentsIntoSimulation, u'updatedSimulationDirectory', CoralReefConnectivity.LoadOSCARCurrentsIntoSimulation, u'updatedSimulationDirectory') 
     1132 
    10781133# Public method: CoralReefConnectivity.LoadHYCOMGOMl0044DCurrentsIntoSimulation 
    10791134 
     
    11301185  simulation. It does not implement vertical migration or other 
    11311186  behaviors that might be appropriate for your species. A newer 
    1132   version of this tool, to be released in 2011, will support vertical 
     1187  version of this tool, to be released in 2012, will support vertical 
    11331188  migration. 
    11341189 
     
    11471202 
    11481203CopyResultMetadata(CoralReefConnectivity.LoadAvisoGeostrophicCurrentsIntoSimulation, u'updatedSimulationDirectory', CoralReefConnectivity.LoadHYCOMGOMl0044DCurrentsIntoSimulation, u'updatedSimulationDirectory') 
     1204 
     1205# Public method: CoralReefConnectivity.LoadHYCOMGLBa0084DEquatorialCurrentsIntoSimulation 
     1206 
     1207AddMethodMetadata(CoralReefConnectivity.LoadHYCOMGLBa0084DEquatorialCurrentsIntoSimulation, 
     1208    shortDescription=_(u'Downloads HYCOM GLBa0.08 ocean currents into a coral reef connectivity simulation.'), 
     1209    longDescription=_HYCOMGLBa008Equatorial_LongDescription % {u'name': 'tool'}, 
     1210    isExposedToPythonCallers=True, 
     1211    isExposedByCOM=True, 
     1212    isExposedAsArcGISTool=True, 
     1213    arcGISDisplayName=_(u'Load HYCOM GLBa0.08 Currents Into Coral Reef Connectivity Simulation'), 
     1214    arcGISToolCategory=_(u'Connectivity Analysis\\Coral Reef Larval Connectivity'), 
     1215    dependencies=[ArcGISDependency(9, 2), ArcGISExtensionDependency(u'spatial'), PythonAggregatedModuleDependency('numpy')]) 
     1216 
     1217CopyArgumentMetadata(CoralReefConnectivity.LoadAvisoGeostrophicCurrentsIntoSimulation, u'cls', CoralReefConnectivity.LoadHYCOMGLBa0084DEquatorialCurrentsIntoSimulation, u'cls') 
     1218 
     1219AddArgumentMetadata(CoralReefConnectivity.LoadHYCOMGLBa0084DEquatorialCurrentsIntoSimulation, u'simulationDirectory', 
     1220    typeMetadata=DirectoryTypeMetadata(mustExist=True), 
     1221    description=_( 
     1222u"""Existing coral reef connectivity simulation directory that should 
     1223recieve the currents. 
     1224 
     1225The directory must have been created using the Create Coral Reef 
     1226Connectivity Simulation tool. 
     1227 
     1228If you have already loaded HYCOM GLBa0.08 currents into the 
     1229simulation, you can use this tool to add currents for an additional 
     1230range of dates so long as they are for the same depth as the original 
     1231currents. If you try to add a different currents product to the 
     1232simulation (e.g. geostrophic currents from Aviso), or for a different 
     1233depth, this tool will report an error. 
     1234 
     1235If you try to load data for a range of dates that have been already 
     1236loaded into the simulation, the downloads for those dates will be 
     1237skipped. There is no way to delete or overwrite the data that has 
     1238already been loaded into the simulation. If you want to overwrite your 
     1239existing data (e.g. you want to switch to using a different depth), 
     1240you must create a new simulation."""), 
     1241    arcGISDisplayName=_(u'Simulation directory to recieve HYCOM currents')) 
     1242 
     1243CopyArgumentMetadata(CoralReefConnectivity.LoadAvisoGeostrophicCurrentsIntoSimulation, u'startDate', CoralReefConnectivity.LoadHYCOMGLBa0084DEquatorialCurrentsIntoSimulation, u'startDate') 
     1244CopyArgumentMetadata(CoralReefConnectivity.LoadAvisoGeostrophicCurrentsIntoSimulation, u'endDate', CoralReefConnectivity.LoadHYCOMGLBa0084DEquatorialCurrentsIntoSimulation, u'endDate') 
     1245 
     1246AddArgumentMetadata(CoralReefConnectivity.LoadHYCOMGLBa0084DEquatorialCurrentsIntoSimulation, u'depth', 
     1247    typeMetadata=FloatTypeMetadata(allowedValues=[0., 10., 20., 30., 50., 75., 100., 125., 150., 200., 250., 300., 400., 500., 600., 700., 800., 900., 1000., 1100., 1200., 1300., 1400., 1500., 1750., 2000., 2500., 3000., 3500., 4000., 4500., 5000., 5500.]), 
     1248    description=_( 
     1249u"""HYCOM depth layer to download currents from. 
     1250 
     1251This tool was designed primarily to study larvae that float at or near 
     1252the surface. The default depth is 0. If you are studying larvae that 
     1253stay submerged, you can choose a deeper depth, but be aware of two 
     1254important points: 
     1255 
     1256* This tool assumes the larvae remain at that depth for the entire 
     1257  simulation. It does not implement vertical migration or other 
     1258  behaviors that might be appropriate for your species. A newer 
     1259  version of this tool, to be released in 2012, will support vertical 
     1260  migration. 
     1261 
     1262* Be aware that the spatial extent of available currents data will 
     1263  shrink as depth increases. For example, if you choose a deep depth 
     1264  such as 250 m, there will be no data available for regions close to 
     1265  shore because the ocean is typically shallower than 250 m in those 
     1266  regions. 
     1267"""), 
     1268    arcGISDisplayName=_(u'Minimum depth')) 
     1269 
     1270CopyArgumentMetadata(HYCOMGLBa008Equatorial4D.CreateArcGISRasters, u'extendYExtent', CoralReefConnectivity.LoadHYCOMGLBa0084DEquatorialCurrentsIntoSimulation, u'extendYExtent') 
     1271CopyArgumentMetadata(HYCOMGLBa008Equatorial4D.CreateArcGISRasters, u'timeout', CoralReefConnectivity.LoadHYCOMGLBa0084DEquatorialCurrentsIntoSimulation, u'timeout') 
     1272CopyArgumentMetadata(HYCOMGLBa008Equatorial4D.CreateArcGISRasters, u'maxRetryTime', CoralReefConnectivity.LoadHYCOMGLBa0084DEquatorialCurrentsIntoSimulation, u'maxRetryTime') 
     1273CopyArgumentMetadata(HYCOMGLBa008Equatorial4D.CreateArcGISRasters, u'cacheDirectory', CoralReefConnectivity.LoadHYCOMGLBa0084DEquatorialCurrentsIntoSimulation, u'cacheDirectory') 
     1274 
     1275CopyResultMetadata(CoralReefConnectivity.LoadAvisoGeostrophicCurrentsIntoSimulation, u'updatedSimulationDirectory', CoralReefConnectivity.LoadHYCOMGLBa0084DEquatorialCurrentsIntoSimulation, u'updatedSimulationDirectory') 
    11491276 
    11501277# Public method: CoralReefConnectivity.RunSimulation 
  • MGET/Branches/Jason/PythonPackage/src/GeoEco/DataProducts/NOAA/OSCAR.py

    r860 r862  
    367367 
    368368_OSCAR_LongDescription = _( 
    369 u"""The NOAA Ocean Surface Current Analyses - Real Time (OSCAR) 
     369u"""The `NOAA Ocean Surface Current Analyses - Real Time (OSCAR) <http://www.oscar.noaa.gov/>`_ 
    370370project publishes global estimates of ocean surface currents by 
    371371combining satellite observations from altimeters that measure the 
     
    387387images occasionally occur 6 days apart according to a regular pattern. 
    388388 
    389 This product is provided in a geographic projection and encompasses 
    390 latitudes 80 S to 80 N and 360 degrees of longitude. The images are 
    391 centered on approximately 160 W to provide an uninterrupted view of 
    392 the tropical Indian, Pacific, and Atlantic Oceans. 
     389This product is provided in a geographic projection with a cell size 
     390of 1/3 degree. It encompasses latitudes 80 N to 80 S and 360 degrees 
     391of longitude. The images are centered on approximately 160 W to 
     392provide an uninterrupted view of the tropical Indian, Pacific, and 
     393Atlantic Oceans. 
    393394 
    394395The OSCAR OPeNDAP dataset accessed by this %(name)s is 
     
    444445the long term mean velocity. The mean is usually computed over all of 
    445446the years that have complete data. For example, at the time this tool 
    446 was developed, in late 2011, the mean was computed over 1993-2010, 
     447was developed in late 2011, the mean was computed over 1993-2010, 
    447448inclusive. (1992 and 2011 were excluded, presumably because they were 
    448449incomplete years.) 
     
    602603the date of the most recent image will be used. The OSCAR OPeNDAP 
    603604dataset that is accessed is a long term archive that may not be 
    604 updated daily. For example, when this tool was written, in late 2011, 
     605updated daily. For example, when this tool was written in late 2011, 
    605606the archive ended in September 2011. 
    606607 
  • MGET/Branches/Jason/PythonPackage/src/GeoEco/Datasets/Virtual.py

    r836 r862  
    915915            else: 
    916916                if start is not None and stop < start: 
    917                     raise IndexError(_(u'%(dim)sMin (%(value1)i) is greater than %(dim)sMax (%(value2)i). %(dim)sMax must be greater than %(dim)sMin.') % {u'dim': dim, u'value1': start, u'value2': stop}) 
     917                    raise IndexError(_(u'%(dim)sMin (%(value1)s) is greater than %(dim)sMax (%(value2)s). %(dim)sMax must be greater than %(dim)sMin.') % {u'dim': dim, u'value1': repr(start), u'value2': repr(stop)}) 
    918918                absStop = bisect.bisect_right(grid.CenterCoords[dim], stop) 
    919919                if absStop == 0: 
  • MGET/Branches/Jason/PythonPackage/src/GeoEco/Datasets/__init__.py

    r860 r862  
    23902390                    if sr is not None and sr.IsGeographic(): 
    23912391                        coord = coord - (coord // 360) * 360        # Convert the requested x coordinate to 0 to 360, regardless of what it currently is 
    2392                     if coord >= self.MaxCoords[d, -1]: 
    2393                         coord = coord - 360                         # If it is beyond the right edge of the grid, subtract 360 in case the grid uses -180 to 180 or some other rotated range 
     2392 
     2393                    # If coord is less than the min x extent, add 360 
     2394                    # until it is greater than or equal it, to handle 
     2395                    # coordinate systems such as NOAA OSCAR, which 
     2396                    # uses a 20 to 380 system. 
     2397 
     2398                    if coord < self.MinCoords[d, 0]: 
     2399                        while coord < self.MinCoords[d, 0]: 
     2400                            coord += 360. 
     2401 
     2402                    # Otherwise, if it is greater than or equal to the 
     2403                    # max x extent, subtract 360 until it is less than 
     2404                    # it, to handle coordinate systems such as MODIS 
     2405                    # L3 which uses a -180 to 180 system. 
     2406 
     2407                    elif coord >= self.MaxCoords[d, -1]: 
     2408                        while coord >= self.MaxCoords[d, -1]: 
     2409                            coord -= 360. 
    23942410 
    23952411                # If this dimension is x, y, or z and has a constant