<commit_before>require 'json'
require 'open-uri'

require_relative 'utils'

module GeoElevation

    SRTM_BASE_URL = 'http://dds.cr.usgs.gov/srtm'
    SRTM1_URL     = '/version2_1/SRTM1/'
    SRTM3_URL     = '/version2_1/SRTM3/'
    DIR_NAME      = "#{Dir.home}/.elevations.rb"

    EGM2008_URL   = 'http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008/Und_min2.5x2.5_egm2008_isw=82_WGS84_TideFree_SE.gz'
    # Test:
    #EGM2008_URL   = 'http://localhost/Und_min2.5x2.5_egm2008_isw=82_WGS84_TideFree_SE.gz'

    class Srtm
        def initialize
            # Just in case...
            json = Retriever::prepare_folder
            # Dictionary with all files and urls (as is saved in ~/.elevations.rb/list.json)
            @files = JSON.load(json)
            @cached_srtm_files = {}
        end

        def get_elevation(latitude, longitude)
            srtm_file = get_file(latitude, longitude)<commit_msg>Url fix #2<commit_after>require 'json'
require 'open-uri'

require_relative 'utils'

module GeoElevation

    SRTM_BASE_URL = 'http://dds.cr.usgs.gov/srtm'
    SRTM1_URL     = '/version2_1/SRTM1/'
    SRTM3_URL     = '/version2_1/SRTM3/'
    DIR_NAME      = "#{Dir.home}/.elevations.rb"

    EGM2008_URL   = 'http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008/Small_Endian/Und_min1x1_egm2008_isw=82_WGS84_TideFree_SE.gz'
    # Test:
    #EGM2008_URL   = 'http://localhost/Und_min2.5x2.5_egm2008_isw=82_WGS84_TideFree_SE.gz'

    class Srtm
        def initialize
            # Just in case...
            json = Retriever::prepare_folder
            # Dictionary with all files and urls (as is saved in ~/.elevations.rb/list.json)
            @files = JSON.load(json)
            @cached_srtm_files = {}
        end

        def get_elevation(latitude, longitude)
            srtm_file = get_file(latitude, longitude)
{'fraction_non_alphanumeric': 0.11521739130434783, 'fraction_numerical': 0.049456521739130434, 'mean_word_length': 2.5268199233716473, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3350441', 'n_tokens_mistral': 775, 'n_tokens_neox': 709, 'n_words': 103}