errechnet, wieviel Grad Länge bei einem gegebenen Grad Breite = 1KM entsprechen
324677
public static function calcOneOnLng($geo_lat, $scale = 'km'){
        switch(strtolower($scale)){
            case 'miles':
                $earth = 3960;
            break;

            case 'km':
            default:
                $earth = 6371;
            break;
        }
        
        //Point 1 cords
        $lat = deg2rad($geo_lat);
        $long1 = deg2rad(0);
        $long2 = deg2rad(1);
        
        //Haversine Formula
        $dlong = $long2 - $long1;
        $sinlong = sin($dlong / 2);
        
        $a = cos($lat) * cos($lat) * ($sinlong * $sinlong);
        $c = 2 * asin(min(1, sqrt($a)));
        
        return (1/($earth * $c));
    }
916240
def CrearAjusteBase(self, 
               pto_emision=1, nro_orden=None,       # unificado, contrato, papel
               coe_ajustado=None,                   # unificado
               nro_contrato=None,                   # contrato
               tipo_formulario=None,                # papel
               nro_formulario=None,                 # papel
               actividad=None,                      # contrato / papel
               cod_grano=None,                      # contrato / papel
               cuit_vendedor=None,                  # contrato / papel
               cuit_comprador=None,                 # contrato / papel
               cuit_corredor=None,                  # contrato / papel
               nro_ing_bruto_vendedor=None,         # papel
               nro_ing_bruto_comprador=None,        # papel
               nro_ing_bruto_corredor=None,         # papel
               tipo_operacion=None,                 # papel
               precio_ref_tn=None,                  # contrato
               cod_grado_ent=None,                  # contrato
               val_grado_ent=None,                  # contrato
               precio_flete_tn=None,                # contrato
               cod_puerto=None,                     # contrato
               des_puerto_localidad=None,           # contrato
               cod_provincia=None,                  # unificado, contrato, papel
               cod_localidad=None,                  # unificado, contrato, papel
               comision_corredor=None,              # papel
               **kwargs
               ):
        ""

        # ajusto nombre de campos para compatibilidad hacia atrás (encabezado):
        if 'cod_localidad_procedencia' in kwargs:
            cod_localidad = kwargs['cod_localidad_procedencia']
        if 'cod_provincia_procedencia' in kwargs:
            cod_provincia = kwargs['cod_provincia_procedencia']
        if 'nro_act_comprador' in kwargs:
            actividad = kwargs['nro_act_comprador']
        if 'cod_tipo_operacion' in kwargs:
            tipo_operacion = kwargs['cod_tipo_operacion']
            
        # limpio los campos especiales (segun validaciones de AFIP)
        if val_grado_ent == 0:
            val_grado_ent = None
        # borrando datos si no corresponden
        if cuit_corredor and int(cuit_corredor) == 0:
            cuit_corredor = None
            comision_corredor = None
            nro_ing_bruto_corredor = None
               
        if cod_puerto and int(cod_puerto) != 14:
            des_puerto_localidad = None             # validacion 1630

        # limpio los campos opcionales para no enviarlos si no corresponde:
        if cod_grado_ent == "":
            cod_grado_ent = None
        if val_grado_ent == 0:
            val_grado_ent = None

        # creo el diccionario con los campos generales del ajuste base:
        self.ajuste = { 'ajusteBase': {
                            'ptoEmision': pto_emision,
                            'nroOrden': nro_orden,
                            'coeAjustado': coe_ajustado,
                            'nroContrato': nro_contrato,
                            'tipoFormulario': tipo_formulario,
                            'nroFormulario': nro_formulario,
                            'actividad': actividad,
                            'codGrano': cod_grano,
                            'cuitVendedor': cuit_vendedor,
                            'cuitComprador': cuit_comprador,
                            'cuitCorredor': cuit_corredor,
                            'nroIngBrutoVendedor': nro_ing_bruto_vendedor,
                            'nroIngBrutoComprador': nro_ing_bruto_comprador,
                            'nroIngBrutoCorredor': nro_ing_bruto_corredor,
                            'tipoOperacion': tipo_operacion,
                            'codPuerto': cod_puerto,
                            'desPuertoLocalidad': des_puerto_localidad,
                            'comisionCorredor': comision_corredor,
                            'precioRefTn': precio_ref_tn,
                            'codGradoEnt': cod_grado_ent,
                            'valGradoEnt': val_grado_ent,
                            'precioFleteTn': precio_flete_tn,
                            'codLocalidad': cod_localidad,
                            'codProv': cod_provincia,
                            'certificados': [],
                            }
                        }
        # para compatibilidad con AgregarCertificado
        self.liquidacion = self.ajuste['ajusteBase']
        # inicializar temporales
        self.__ajuste_base = None
        self.__ajuste_debito = None
        self.__ajuste_credito = None
        return True
309293
def generic_modis5kmto1km(*data5km):
    
    cols5km = np.arange(2, 1354, 5)
    cols1km = np.arange(1354)
    lines = data5km[0].shape[0] * 5
    rows5km = np.arange(2, lines, 5)
    rows1km = np.arange(lines)

    along_track_order = 1
    cross_track_order = 3

    satint = Interpolator(list(data5km),
                          (rows5km, cols5km),
                          (rows1km, cols1km),
                          along_track_order,
                          cross_track_order,
                          chunk_size=10)
    satint.fill_borders("y", "x")
    return satint.interpolate()
735183
def internal2external_grad(xi, bounds):
    

    ge = np.empty_like(xi)

    for i, (v, bound) in enumerate(zip(xi, bounds)):

        a = bound[0]  # minimum
        b = bound[1]  # maximum

        if a == None and b == None:  # No constraints
            ge[i] = 1.0

        elif b == None:  # only min
            ge[i] = v / np.sqrt(v ** 2 + 1)

        elif a == None:  # only max
            ge[i] = -v / np.sqrt(v ** 2 + 1)

        else:  # both min and max
            ge[i] = (b - a) * np.cos(v) / 2.

    return ge
1366435
def getN21NG(rates, ver, lamb, br, reactfn):
    
    with h5py.File(str(reactfn), 'r', libver='latest') as f:
        A = f['/N2+1NG/A'].value
        lambdaA = f['/N2+1NG/lambda'].value.ravel(order='F')
        franckcondon = f['/N2+1NG/fc'].value

    return doBandTrapz(A, lambdaA, franckcondon, rates.loc[..., 'p1ng'], lamb, ver, rates.alt_km, br)
19816
@Override
    public ReisMogelijkheden getModel(InputStream stream) {
        SimpleDateFormat format = new SimpleDateFormat(NsApi.DATETIME_FORMAT);
        try {
            Xml xml = Xml.getXml(stream, "ReisMogelijkheden");
            List<ReisMogelijkheid> reisMogelijkheden = new ArrayList<>(xml.children("ReisMogelijkheid")
                    .size());
            for (Xml reisMogelijkheidXml : xml.children("ReisMogelijkheid")) {
                List<Melding> meldingen = new LinkedList<>();
                if (reisMogelijkheidXml.isPresent("Melding")) {
                    for (Xml meldingXml : reisMogelijkheidXml.children("Melding")) {
                        String id = meldingXml.child("Id").content();
                        boolean ernstig = Boolean.parseBoolean(meldingXml.child("Ernstig").content());
                        String text = meldingXml.child("Text").content();
                        meldingen.add(new Melding(id, ernstig, text));
                    }
                }
                int aantalOverstappen = Integer.parseInt(reisMogelijkheidXml.child("AantalOverstappen").content());
                int geplandeReisTijdMinuten = getReistijdInMinuten(reisMogelijkheidXml.child("GeplandeReisTijd")
                        .content());
                int actueleReisTijdMinuten = getReistijdInMinuten(reisMogelijkheidXml.child("ActueleReisTijd")
                        .content());
                boolean optimaal = true;
                if (reisMogelijkheidXml.isPresent("Optimaal")) {
                    optimaal = Boolean.parseBoolean(reisMogelijkheidXml.child("Optimaal").content());
                }
                Date geplandeVertrekTijd = format.parse(reisMogelijkheidXml.child("GeplandeVertrekTijd").content());
                Date actueleVertrekTijd = format.parse(reisMogelijkheidXml.child("ActueleVertrekTijd").content());
                Date geplandeAankomstTijd = format.parse(reisMogelijkheidXml.child("GeplandeAankomstTijd").content());
                Date actueleAankomstTijd = format.parse(reisMogelijkheidXml.child("ActueleAankomstTijd").content());
                String aankomstVertraging = reisMogelijkheidXml.child("AankomstVertraging").content();
                String status = reisMogelijkheidXml.child("Status").content();
                List<ReisDeel> reisDelen = new ArrayList<>(reisMogelijkheidXml.children("ReisDeel").size());
                for (Xml reisDeelXml : reisMogelijkheidXml.children("ReisDeel")) {
                    String reisSoort = reisDeelXml.attr("reisSoort");
                    String vervoerder = reisDeelXml.child("Vervoerder").content();
                    String vervoerType = reisDeelXml.child("VervoerType").content();
                    int ritNummer = Integer.parseInt(reisDeelXml.child("RitNummer").content());
                    String statusReisdeel = reisDeelXml.child("Status").content();
                    String geplandeStoringId = reisDeelXml.child("GeplandeStoringId").content();
                    String ongeplandeStoringId = reisDeelXml.child("OngeplandeStoringId").content();
                    List<ReisStop> reisStops = new ArrayList<>(reisDeelXml.children("ReisStop").size());
                    for (Xml reisStopXml : reisDeelXml.children("ReisStop")) {
                        String naam = reisStopXml.child("Naam").content();
                        Date tijd = format.parse(reisStopXml.child("Tijd").content());
                        String spoor = reisStopXml.child("Spoor").content();
                        boolean gewijzigdVertrekspoor = false;
                        if (spoor != null) {
                            gewijzigdVertrekspoor = Boolean.parseBoolean(reisStopXml.child("Spoor").attr("wijziging"));
                        }
                        reisStops.add(new ReisStop(naam, tijd, spoor, gewijzigdVertrekspoor));
                    }
                    List<String> reisDetails = new ArrayList<>(reisDeelXml.child("Reisdetails")
                            .children("Reisdetail").size());
                    for (Xml reisDetailXml : reisDeelXml.child("Reisdetails").children("Reisdetail")) {
                        reisDetails.add(reisDetailXml.content());
                    }
                    reisDelen.add(new ReisDeel(reisSoort, vervoerder, vervoerType, ritNummer, statusReisdeel,
                            reisStops, ongeplandeStoringId, geplandeStoringId, reisDetails));
                }
                reisMogelijkheden.add(new ReisMogelijkheid(meldingen, aantalOverstappen, geplandeReisTijdMinuten,
                        actueleReisTijdMinuten, aankomstVertraging, optimaal, geplandeVertrekTijd, actueleVertrekTijd,
                        geplandeAankomstTijd, actueleAankomstTijd, status, reisDelen));
            }
            return new ReisMogelijkheden(reisMogelijkheden);
        }
        catch (ParseException e) {
            logger.error("Error parsing stream to actuele vertrektijden", e);
            throw new NsApiException("Error parsing stream to actuele vertrektijden", e);
        }
    }
984204
def V(x, requires_grad=False, volatile=False):
    ''' '''
    return map_over(x, lambda o: V_(o, requires_grad, volatile))
1224440
public static boolean alg_52(int[] blz, int[] number) {
        boolean ok;

        if (number[0] == 9) {
            ok = alg_20(blz, number);

        } else {
            //Kontonummer muss 8-stellig sein (mgl: number[2] darf 0 sein, d.h. Kontonummer faengt mit 0 an
            if (number[0] != 0 || number[1] != 0 || number[2] == 0) {
                ok = false;

            } else {
                int[] weights = new int[]{4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};

                //ESER-Nummer bauen
                int[] eser = new int[12];

                int knstartindex = 4;
                while (number[knstartindex] == 0) {
                    knstartindex++;
                }

                // kontonummer -> eser
                int i = 11;
                for (int j = 9; j >= knstartindex; j--, i--) {
                    eser[i] = number[j];
                }

                //Pruefziffer number[3] muss 0 gesetzt werden
                int indexOfPruefziffer = i;
                eser[i--] = 0;

                //erste Stelle der Kontonummer;
                eser[i--] = number[2];

                for (int j = 7; j > 3; j--, i--) {
                    eser[i] = blz[j];
                }

                //Ende Eser-Nummer bauen
                int sum = addProducts(eser, 0, 11, weights, false);
                int crc = sum % 11;

                int factor = 0;
                boolean found = false;

                while (!found && factor < 10) {
                    int tocheck = (crc + factor * weights[indexOfPruefziffer]) % 11;
                    if (tocheck == 10) {
                        crc = factor;
                        found = true;
                    }
                    factor++;
                }

                ok = found && number[3] == crc;
            }
        }

        return ok;
    }
95729
public function getLongitude()
    {
        //brak tagu GPS
        if (!isset($this->_exif['GPSLongitude']) || !isset($this->_exif['GPSLongitudeRef'])) {
            return;
        }
        //tag źle sformatowany
        if (!is_array($this->_exif['GPSLongitude']) || count($this->_exif['GPSLongitude']) != 3) {
            return;
        }
        //obliczanie do eleganckiej postaci
        $hours = round($this->_gpsValue($this->_exif['GPSLongitude'][0]));
        $minutes = round($this->_gpsValue($this->_exif['GPSLongitude'][1])) / 60;
        $seconds = $this->_gpsValue($this->_exif['GPSLongitude'][1]) / 3600;
        $sign = 1;
        if (strtolower($this->_exif['GPSLongitudeRef']) != 'e') {
            $sign = -1;
        }
        //zwrot w formie ułamka
        return $sign * ($hours + $minutes + $seconds);
    }
1047469
function bs__translate(number, withoutSuffix, key) {
        var result = number + ' ';
        switch (key) {
        case 'm':
            return withoutSuffix ? 'jedna minuta' : 'jedne minute';
        case 'mm':
            if (number === 1) {
                result += 'minuta';
            } else if (number === 2 || number === 3 || number === 4) {
                result += 'minute';
            } else {
                result += 'minuta';
            }
            return result;
        case 'h':
            return withoutSuffix ? 'jedan sat' : 'jednog sata';
        case 'hh':
            if (number === 1) {
                result += 'sat';
            } else if (number === 2 || number === 3 || number === 4) {
                result += 'sata';
            } else {
                result += 'sati';
            }
            return result;
        case 'dd':
            if (number === 1) {
                result += 'dan';
            } else {
                result += 'dana';
            }
            return result;
        case 'MM':
            if (number === 1) {
                result += 'mjesec';
            } else if (number === 2 || number === 3 || number === 4) {
                result += 'mjeseca';
            } else {
                result += 'mjeseci';
            }
            return result;
        case 'yy':
            if (number === 1) {
                result += 'godina';
            } else if (number === 2 || number === 3 || number === 4) {
                result += 'godine';
            } else {
                result += 'godina';
            }
            return result;
        }
    }
136393
function _hsv2rgb(data, addr, H,S,V) {
	if (V < 0.0001) {
		data[addr] = data[addr+1] = data[addr+2] = 0;
		return;
	}

	if (V>1) V = 1;

	if (S == 0) {
		data[addr] = data[addr+1] = data[addr+2] = v2b(V);
		return;
	}

	if (S>1) S = 1;

	var hue = H < 0 ? (H + 360) : (H >= 360 ? H - 360 : H),
	    st = (hue/60),
	    oct = st-(st|0), // [0...1]
	    y = hsv_angle_correction ? /* istanbul ignore next */ Math.sin((oct-.5)*1.0471975512)+.5 : oct,
	    s = S*V,
	    ns = V - s,
	    _ns = v2b(ns),
	    _v = v2b(V);

	switch (st|0) {
	case 0: data[addr] = _v;          data[addr+1] = v2b(ns+s*y); data[addr+2] = _ns;         return;
	case 1: data[addr] = v2b(V-s*y);  data[addr+1] = _v;          data[addr+2] = _ns;         return;
	case 2: data[addr] = _ns;         data[addr+1] = _v;          data[addr+2] = v2b(ns+s*y); return;
	case 3: data[addr] = _ns;         data[addr+1] = v2b(V-s*y);  data[addr+2] = _v;          return;
	case 4: data[addr] = v2b(ns+s*y); data[addr+1] = _ns;         data[addr+2] = _v;          return;
	}
	/*   5: */
	        data[addr] = _v;          data[addr+1] = _ns;         data[addr+2] = v2b(V-s*y);
}
647806
def gradfunc(self, p):
        
        self._set_stochastics(p)
        for i in xrange(self.len):
            self.grad[i] = self.diff(i)

        return -1 * self.grad
676680
protected void doTremoloEffekt(ChannelMemory aktMemo)
	{
		int volumeAdd;
		switch (aktMemo.tremoloType & 0x03)
		{
			case 1: volumeAdd = (Helpers.ModRampDownTable[aktMemo.tremoloTablePos]);	// Sawtooth
					break;
			case 2: volumeAdd = (Helpers.ModSquareTable  [aktMemo.tremoloTablePos]);	// Squarewave
					break;
			case 3:	volumeAdd = (Helpers.ModRandomTable  [aktMemo.tremoloTablePos]);	// Random.
					break;
			default:volumeAdd = (Helpers.ModSinusTable   [aktMemo.tremoloTablePos]);	// Sinus
					break;
		}

		volumeAdd = (volumeAdd * aktMemo.tremoloAmplitude) >> 7;
		aktMemo.currentVolume = aktMemo.currentSetVolume + volumeAdd;
		aktMemo.tremoloTablePos = (aktMemo.tremoloTablePos + aktMemo.tremoloStep) & 0x3F;
	}
394547
private static function hsl2rgb($h, $s, $l, &$r, &$g, &$b)
    {
        if ($s == 0) {
            $r = round($l * 255);
            $g = $r;
            $b = $r;

            return;
        }

        $temp1;
        if ($l < 0.5) {
            $temp1 = $l * (1.0 + $s);
        } else {
            $temp1 = $l + $s - $l * $s;
        }

        $temp2 = 2 * $l - $temp1;

        $h = $h / 360;

        $tempR = $h + (1 / 3);
        $tempG = $h;
        $tempB = $h - (1 / 3);

        if ($tempR < 0) {
            $tempR++;
        } elseif ($tempR > 1) {
            $tempR--;
        }

        if ($tempG < 0) {
            $tempG++;
        } elseif ($tempG > 1) {
            $tempG--;
        }

        if ($tempB < 0) {
            $tempB++;
        } elseif ($tempB > 1) {
            $tempB--;
        }

        if (6 * $tempR < 1) {
            $r = $temp2 + ($temp1 - $temp2) * 6 * $tempR;
        } elseif (2 * $tempR < 1) {
            $r = $temp1;
        } elseif (3 * $tempR < 2) {
            $r = $temp2 + ($temp1 - $temp2) * ((2 / 3) - $tempR) * 6;
        } else {
            $r = $temp2;
        }

        if (6 * $tempG < 1) {
            $g = $temp2 + ($temp1 - $temp2) * 6 * $tempG;
        } elseif (2 * $tempG < 1) {
            $g = $temp1;
        } elseif (3 * $tempG < 2) {
            $g = $temp2 + ($temp1 - $temp2) * ((2 / 3) - $tempG) * 6;
        } else {
            $g = $temp2;
        }

        if (6 * $tempB < 1) {
            $b = $temp2 + ($temp1 - $temp2) * 6 * $tempB;
        } elseif (2 * $tempB < 1) {
            $b = $temp1;
        } elseif (3 * $tempB < 2) {
            $b = $temp2 + ($temp1 - $temp2) * ((2 / 3) - $tempB) * 6;
        } else {
            $b = $temp2;
        }

        $r = round($r * 255);
        $g = round($g * 255);
        $b = round($b * 255);
    }
177723
public String suchenAkt(ArrayList<String> bereitsVersucht) {
        // passende URL zum Laden der Filmliste suchen
        String retUrl;
        if (listeFilmlistenUrls_akt.isEmpty()) {
            // bei leerer Liste immer aktualisieren
            updateURLsFilmlisten(true);
        } else if (firstSearchAkt) {
            // nach dem Programmstart wird die Liste einmal aktualisiert aber
            // da sich die Listen nicht ändern, nur jeden xx Start
            int nr = new Random().nextInt(UPDATE_LISTE_MAX);
            if (nr == 0) {
                updateURLsFilmlisten(true);
            }
        }
        firstSearchAkt = false;
        retUrl = (listeFilmlistenUrls_akt.getRand(bereitsVersucht)); //eine Zufällige Adresse wählen
        if (bereitsVersucht != null) {
            bereitsVersucht.add(retUrl);
        }
        return retUrl;
    }
676521
private static void updateDirecotryDigest(final String path, final File file, MessageDigest md) throws Exception {
		String relativePath = file.getCanonicalPath().substring(path.length());
		relativePath = relativePath.replace('\\', '/');		// normalizacja ścieżki
		if(file.isDirectory()) {
			md.update(relativePath.getBytes(Charset.forName("UTF8")));
			if(logger.isLoggable(LOG_LEVEL)) {
				countDigest(md.getAlgorithm(), new PathNameInputStream(relativePath));
			}

			final File[] content = file.listFiles();
			Arrays.sort(content, new Comparator<File>() {
				@Override
				public int compare(File f1, File f2) {
					return f1.getName().compareTo(f2.getName());
				}
			});

			for(File subFile : content) {
				updateDirecotryDigest(path, subFile, md);
			}
		} else {
			md.update(relativePath.getBytes(Charset.forName("UTF8")));
			if(logger.isLoggable(LOG_LEVEL)) {
				countDigest(md.getAlgorithm(), new PathNameInputStream(relativePath));
			}

			updateDigest(md, new FileInputStream(file));
			if(logger.isLoggable(LOG_LEVEL)) {
				countDigest(md.getAlgorithm(), new FileNameInputStream(file, relativePath));
			}
		}
	}
383086
function hr__translate(number, withoutSuffix, key) {
        var result = number + ' ';
        switch (key) {
        case 'm':
            return withoutSuffix ? 'jedna minuta' : 'jedne minute';
        case 'mm':
            if (number === 1) {
                result += 'minuta';
            } else if (number === 2 || number === 3 || number === 4) {
                result += 'minute';
            } else {
                result += 'minuta';
            }
            return result;
        case 'h':
            return withoutSuffix ? 'jedan sat' : 'jednog sata';
        case 'hh':
            if (number === 1) {
                result += 'sat';
            } else if (number === 2 || number === 3 || number === 4) {
                result += 'sata';
            } else {
                result += 'sati';
            }
            return result;
        case 'dd':
            if (number === 1) {
                result += 'dan';
            } else {
                result += 'dana';
            }
            return result;
        case 'MM':
            if (number === 1) {
                result += 'mjesec';
            } else if (number === 2 || number === 3 || number === 4) {
                result += 'mjeseca';
            } else {
                result += 'mjeseci';
            }
            return result;
        case 'yy':
            if (number === 1) {
                result += 'godina';
            } else if (number === 2 || number === 3 || number === 4) {
                result += 'godine';
            } else {
                result += 'godina';
            }
            return result;
        }
    }