Calls external shell script `get_nlcd.sh` to fetch:

    2011 Land Use Land Cover (nlcd) grids, 30 m
    
    http://www.mrlc.gov/nlcd11_leg.php
517963
def get_nlcd_fn():
    
    #This is original filename, which requires ~17 GB
    #nlcd_fn = os.path.join(datadir, 'nlcd_2011_landcover_2011_edition_2014_10_10/nlcd_2011_landcover_2011_edition_2014_10_10.img')
    #get_nlcd.sh now creates a compressed GTiff, which is 1.1 GB
    nlcd_fn = os.path.join(datadir, 'nlcd_2011_landcover_2011_edition_2014_10_10/nlcd_2011_landcover_2011_edition_2014_10_10.tif')
    if not os.path.exists(nlcd_fn):
        cmd = ['get_nlcd.sh',]
        #subprocess.call(cmd)
        sys.exit("Missing nlcd data source. If already downloaded, specify correct datadir. If not, run `%s` to download" % cmd[0])
    return nlcd_fn
823945
def get_log_dir():
    
    PATH = ''
    if platform.system() in ('Linux', 'Darwin'):
        PATH = tempfile.mkdtemp(prefix='andes-')

    elif platform.system() == 'Windows':
        APPDATA = os.getenv('APPDATA')
        PATH = os.path.join(APPDATA, 'andes')

    if not os.path.exists(PATH):
        os.makedirs(PATH)
    return PATH
1025919
function () {
            // CONUS Extent: (-124.848974, 24.396308) - (-66.885444, 49.384358)
            // TODO: Expand this extent to cover HI when the server NO_DATA value issue is resolved.
            TiledElevationCoverage.call(this, {
                coverageSector: new Sector(24.396308, 49.384358, -124.848974, -66.885444),
                resolution: 0.000092592592593,
                retrievalImageFormat: "application/bil16",
                minElevation: -11000,
                maxElevation: 8850,
                urlBuilder: new WmsUrlBuilder("https://worldwind26.arc.nasa.gov/elev", "USGS-NED", "", "1.3.0")
            });

            this.displayName = "USGS NED Earth Elevation Coverage";
        }
406469
@GwtIncompatible("Unnecessary")
  private String getMapPath(String outputFile) {
    String basePath = "";

    if (outputFile.isEmpty()) {
      // If we have a js_module_binary rule, output the maps
      // at modulename_props_map.out, etc.
      if (!config.moduleOutputPathPrefix.isEmpty()) {
        basePath = config.moduleOutputPathPrefix;
      } else {
        basePath = "jscompiler";
      }
    } else {
      // Get the path of the output file.
      File file = new File(outputFile);

      String outputFileName = file.getName();

      // Strip the .js from the name.
      if (outputFileName.endsWith(".js")) {
        outputFileName =
            outputFileName.substring(0, outputFileName.length() - 3);
      }

      String fileParent = file.getParent();
      if (fileParent == null) {
        basePath = outputFileName;
      } else {
        basePath = file.getParent() + File.separatorChar + outputFileName;
      }
    }

    return basePath;
  }
14899
function getCmd(program, opt) {
            var cmd,
                expr;

            if(program==='ogr2ogr') {

                if(opt==='where') {
                    expr = [
                        '-where ',
                        "\"", specs.key, " IN ",
                        "('", specs.val, "')\" ",
                        '-clipsrc ',
                        specs.bounds.join(' ')
                    ].join('');
                }
                else if(opt==='clipsrc') {
                    expr = [
                        '-clipsrc ',
                        specs.bounds.join(' ')
                    ].join('');
                }
                else  expr = '';

                cmd = [
                    "ogr2ogr -f GeoJSON",
                    expr,
                    common.geojsonDir + common.tn(r, s.name, v.name, 'geo.json'),
                    common.wgetDir + common.srcPrefix + common.bn(r, v.src, 'shp')
                ].join(' ');

            }
            else if(program==='mapshaper') {
                cmd = [
                    mapshaper,
                    common.wgetDir + common.srcPrefix + common.bn(r, v.src, 'shp'),
                    "encoding=utf8",
                    "-clip",
                    common.wgetDir + common.tn(r, s.name, specs.src, 'shp'),
                    "-filter remove-empty",
                    "-o",
                    common.geojsonDir + common.tn(r, s.name, v.name, 'geo.json')
               ].join(' ');
            }

            return cmd;
        }
274815
def _ftp_nlst(self, dir_name):
        """"""
        assert compat.is_native(dir_name)
        lines = []

        def _add_line(status, line):
            lines.append(line)

        cmd = "NLST " + dir_name
        self._ftp_retrlines_native(cmd, _add_line, self.encoding)
        # print(cmd, lines)
        return lines
1336638
private static String findGnuplotHelperScript() {
    if(!GnuplotInstaller.FOUND_GP) {
      LOG.warn("Skipping Gnuplot Shell Script Install since Gnuplot executable was not found");
      return null;
    }
    if(!GnuplotInstaller.GP_FILE.exists()) {
      GnuplotInstaller.installMyGnuPlot();
    }
    if(GnuplotInstaller.GP_FILE.exists() && GnuplotInstaller.GP_FILE.canExecute()) {
      LOG.info("Auto Installed Gnuplot Invoker at [{}]", GnuplotInstaller.GP_FILE.getAbsolutePath());
      return GnuplotInstaller.GP_FILE.getAbsolutePath();
    }
    
    final URL url = GraphHandler.class.getClassLoader().getResource(WRAPPER);
    if (url == null) {
      throw new RuntimeException("Couldn't find " + WRAPPER + " on the"
        + " CLASSPATH: " + System.getProperty("java.class.path"));
    }
    final String path = url.getFile();
    LOG.debug("Using Gnuplot wrapper at {}", path);
    final File file = new File(path);
    final String error;
    if (!file.exists()) {
      error = "non-existent";
    } else if (!file.canExecute()) {
      error = "non-executable";
    } else if (!file.canRead()) {
      error = "unreadable";
    } else {
      return path;
    }
    throw new RuntimeException("The " + WRAPPER + " found on the"
      + " CLASSPATH (" + path + ") is a " + error + " file...  WTF?"
      + "  CLASSPATH=" + System.getProperty("java.class.path"));
  }
1256161
def get_geo_info(filename, band=1):
    ''' 
    '''
    sourceds = gdal.Open(filename, GA_ReadOnly)
    ndv = sourceds.GetRasterBand(band).GetNoDataValue()
    xsize = sourceds.RasterXSize
    ysize = sourceds.RasterYSize
    geot = sourceds.GetGeoTransform()
    projection = osr.SpatialReference()
    projection.ImportFromWkt(sourceds.GetProjectionRef())
    datatype = sourceds.GetRasterBand(band).DataType
    datatype = gdal.GetDataTypeName(datatype)
    return ndv, xsize, ysize, geot, projection, datatype
369093
public function getGeoJson(): ?string
    {
        if (! ($code = $this->getIsoAlpha2())) {
            return null;
        }

        return file_exists($file = __DIR__.'/../resources/geodata/'.mb_strtolower($code).'.json') ? file_get_contents($file) : null;
    }
1320054
def _get_shells():
    '''
    
    '''
    start = time.time()
    if 'sh.last_shells' in __context__:
        if start - __context__['sh.last_shells'] > 5:
            __context__['sh.last_shells'] = start
        else:
            __context__['sh.shells'] = __salt__['cmd.shells']()
    else:
        __context__['sh.last_shells'] = start
        __context__['sh.shells'] = __salt__['cmd.shells']()
    return __context__['sh.shells']
686867
def mkdir(self, src, extra_args=[]):
        ''''''
        return self._getStdOutCmd([self._hadoop_cmd, 'fs', '-mkdir'] + extra_args + [self._full_hdfs_path(src)], True)
751476
def get_scenario_from_nrml(oqparam, fname):
    
    if not oqparam.imtls:
        oqparam.set_risk_imtls(get_risk_models(oqparam))
    imts = sorted(oqparam.imtls)
    num_imts = len(imts)
    imt_dt = numpy.dtype([(imt, F32) for imt in imts])
    gmfset = nrml.read(fname).gmfCollection.gmfSet
    eids, sitecounts = _extract_eids_sitecounts(gmfset)
    coords = sorted(sitecounts)
    oqparam.sites = [(lon, lat, 0) for lon, lat in coords]
    site_idx = {lonlat: i for i, lonlat in enumerate(coords)}
    oqparam.number_of_ground_motion_fields = num_events = len(eids)
    num_sites = len(oqparam.sites)
    gmf_by_imt = numpy.zeros((num_events, num_sites), imt_dt)
    counts = collections.Counter()
    for i, gmf in enumerate(gmfset):
        if len(gmf) != num_sites:  # there must be one node per site
            raise InvalidFile('Expected %d sites, got %d nodes in %s, line %d'
                              % (num_sites, len(gmf), fname, gmf.lineno))
        counts[gmf['ruptureId']] += 1
        imt = gmf['IMT']
        if imt == 'SA':
            imt = 'SA(%s)' % gmf['saPeriod']
        for node in gmf:
            sid = site_idx[node['lon'], node['lat']]
            gmf_by_imt[imt][i % num_events, sid] = node['gmv']

    for rupid, count in sorted(counts.items()):
        if count < num_imts:
            raise InvalidFile("Found a missing ruptureId %d in %s" %
                              (rupid, fname))
        elif count > num_imts:
            raise InvalidFile("Found a duplicated ruptureId '%s' in %s" %
                              (rupid, fname))
    expected_gmvs_per_site = num_imts * len(eids)
    for lonlat, counts in sitecounts.items():
        if counts != expected_gmvs_per_site:
            raise InvalidFile(
                '%s: expected %d gmvs at location %s, found %d' %
                (fname, expected_gmvs_per_site, lonlat, counts))
    return eids, gmf_by_imt.T
1254226
function doCalc() {
            var distance = lengthMeasurer.getLength(pathPositions, false, WorldWind.GREAT_CIRCLE);
            var terrainDistance = lengthMeasurer.getLength(pathPositions, true, WorldWind.GREAT_CIRCLE);
            var geographicDistance = lengthMeasurer.getGeographicDistance(pathPositions, WorldWind.GREAT_CIRCLE);
            var area = areaMeasurer.getArea(pathPositions, false);
            var terrainArea = areaMeasurer.getArea(pathPositions, true);

            // Display the results.
            geoDistSpan.textContent = (geographicDistance / 1e3).toFixed(3);
            distSpan.textContent = (distance / 1e3).toFixed(3);
            terrainDistSpan.textContent = (terrainDistance / 1e3).toFixed(3);
            projectedAreaSpan.textContent = (area / 1e6).toFixed(3);
            terrainAreaSpan.textContent = (terrainArea / 1e6).toFixed(3);
        }
1107573
def command_ls(self, list_what):
        
        if list_what in ('available', 'mounted', 'unmounted'):
            callback = getattr(self.environment, 'get_%s_ids' % list_what)
            lst = callback()
        else:
            lst = []
        if len(lst) != 0:
            print(("\n".join(lst)))
26479
def get_dm_online(self):
        
        if not requests:
            return False
        try:
            req = requests.get("https://earthref.org/MagIC/data-models/3.0.json", timeout=3)
            if not req.ok:
                return False
            return req
        except (requests.exceptions.ConnectTimeout, requests.exceptions.ConnectionError,
                requests.exceptions.ReadTimeout):
            return False
865855
def _cas_1(self):
        ''''''

        lonc = self._format_lon(self.lonm)
        latc = self._format_lat(self.latm)
        img = self._format_name_map(lonc, latc)
        img_map = BinaryTable(img, self.path_pdsfiles)

        return img_map.extract_grid(self.lonm, self.lonM, self.latm, self.latM)
400121
def ls(self, src, extra_args=[]):
        ''''''
        src = [self._full_hdfs_path(x) for x in src]
        output = self._getStdOutCmd([self._hadoop_cmd, 'fs', '-ls'] + extra_args + src, True)
        return self._transform_ls_output(output, self.hdfs_url)