Hirdetés

Új hozzászólás Aktív témák

  • olivera88

    veterán

    válasz dabadab #2110 üzenetére

    Értem. Köszi. De a letöltés most se akar jó lenni valamiért. :( Most is HTML fájl töltődik.

    #!/bin/bash

    # access token
    TOKEN="__5yLVTdr-sGeHoPitnFc7TZ6MhBcJxuSsoZp6y0leVHU__"

    # file size min and max values - if the file's size falls outside of this range it is considered faulty
    MIN_SIZE="38797312"
    MAX_SIZE="45088768"

    # time range - how many hour's data a single file contains
    RANGE=12


    function download_file()
    {
    # end time
    TO="$1"

    # start time - it is calculated a little oddly
    FROM=$((${TO}-${RANGE}))
    if [ $FROM -gt 0 ] ; then
    FROM=$(($FROM+1))
    fi

    # add leading zeroes if needed
    FROM="$(printf "%02d" "${FROM}")"
    RANGE="$(printf "%02d" "${RANGE}")"

    # url of the data
    URL="http://dcpc-nwp.meteo.fr/services/PS_GetCache_DCPCPreviNum?token=${__5yLVTdr-sGeHoPitnFc7TZ6MhBcJxuSsoZp6y0leVHU__}&model=ARPEGE&grid=0.1&package=SP1&time=${FROM}H${TO}H&referencetime=$(date +'%Y-%m-%d')T${RANGE}:00:00Z"

    # output file name
    OUT_FILE="ARPEGE_SP1_${TO}H.grib2"

    while true ; do
    # get the file
    wget "${URL}" -O "${OUT_FILE}"

    # check the filesize
    size=$(stat -c \%s "${OUT_FILE}" )
    if [ $size -ge "${MIN_SIZE}" -a $size -le "${MAX_SIZE}" ] ; then
    # size is OK, leave loop
    break
    else
    # something went wrong, wait a little and retry
    sleep 5m
    fi
    done

    }
    for TO in 12 24 36 48 60 72 ; do
    download_file "${TO}"
    sleep 5m
    done

    [ Szerkesztve ]

    LG Velvet 5G Android 11 - Windows 10 Pro x64 & Debian 11 Bullseye - WoWS unsinkable_sam_

Új hozzászólás Aktív témák