Delete downloader.py
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
import subprocess
|
||||
import os
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
class CopernicusDownloader:
|
||||
def __init__(self, user, pwd):
|
||||
self.user = user
|
||||
self.pwd = pwd
|
||||
self.dataset_id = "cmems_mod_ibi_phy_anfc_0.027deg-2D_PT1H-m"
|
||||
self.service_id = "IBI_ANALYSISFORECAST_PHY_005_001-TDS"
|
||||
self.motu_url = "https://nrt.cmems-du.eu/motu-web/Motu"
|
||||
|
||||
def download(self, lat_min, lat_max, lon_min, lon_max, days, output_dir):
|
||||
today = datetime.utcnow()
|
||||
start_date = today.strftime("%Y-%m-%dT00:00:00")
|
||||
end_date = (today + timedelta(days=days)).strftime("%Y-%m-%dT23:00:00")
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
output_name = f"copernicus_{start_date[:10]}_{end_date[:10]}.nc"
|
||||
output_path = os.path.join(output_dir, output_name)
|
||||
|
||||
cmd = [
|
||||
"motuclient",
|
||||
"--motu", self.motu_url,
|
||||
"--service-id", self.service_id,
|
||||
"--product-id", self.dataset_id,
|
||||
"--longitude-min", str(lon_min),
|
||||
"--longitude-max", str(lon_max),
|
||||
"--latitude-min", str(lat_min),
|
||||
"--latitude-max", str(lat_max),
|
||||
"--date-min", start_date,
|
||||
"--date-max", end_date,
|
||||
"--variable", "uo",
|
||||
"--variable", "vo",
|
||||
"--variable", "zos",
|
||||
"--variable", "thetao",
|
||||
"--out-dir", output_dir,
|
||||
"--out-name", output_name,
|
||||
"--user", self.user,
|
||||
"--pwd", self.pwd
|
||||
]
|
||||
|
||||
subprocess.run(cmd, check=True)
|
||||
Reference in New Issue
Block a user