From aaf890e6816d84e9762f7a18149a464f1f8caca9 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Thu, 5 Oct 2023 10:32:42 -0400 Subject: [PATCH 1/3] ENH: use pysatNASA unzip --- pysatModels/models/ucar_tiegcm.py | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/pysatModels/models/ucar_tiegcm.py b/pysatModels/models/ucar_tiegcm.py index 43ac1046..728c35b2 100644 --- a/pysatModels/models/ucar_tiegcm.py +++ b/pysatModels/models/ucar_tiegcm.py @@ -26,9 +26,7 @@ import functools import os import pandas as pds -import tempfile import warnings -import zipfile import pysat @@ -214,10 +212,11 @@ def load(fnames, tag='', inst_id='', **kwargs): '': {'icon': {'remote_dir': '/pub/data/icon/l4/tiegcm/{year:04d}/', 'fname': ''.join(['icon_l4-3_tiegcm_{year:04d}-{month:02d}-', '{day:02d}_v{version:02d}r{revision:03d}', - '.zip'])}}} + '.zip']), + 'zip_method': 'zip'}}} -def download(date_array, tag, inst_id, data_path=None, **kwargs): +def download(date_array, tag, inst_id, data_path, **kwargs): """Download UCAR TIE-GCM from NASA CDAWeb. Parameters @@ -232,7 +231,7 @@ def download(date_array, tag, inst_id, data_path=None, **kwargs): Instrument ID string identifier used for particular dataset. This input is provided by pysat. data_path : str or NoneType - Path to directory to download data to. (default=None) + Path to directory to download data to. **kwargs : dict Additional keywords supplied by user when invoking the download routine attached to a pysat.Instrument object are passed to this @@ -248,27 +247,10 @@ def download(date_array, tag, inst_id, data_path=None, **kwargs): if tag == '': warnings.warn('Not implemented, currently no support for Globus.') elif tag == 'icon': - # Set up temporary directory for zip files - temp_dir = tempfile.TemporaryDirectory() - # Download using NASA CDAWeb methods in pysatNASA - cdw.download(date_array, tag, inst_id, data_path=temp_dir.name, + cdw.download(date_array, tag=tag, inst_id=inst_id, data_path=data_path, supported_tags=download_tags) - # Get a list of files in `temp_dir` - dl_files = pysat.Files.from_os( - temp_dir.name, format_str=download_tags[inst_id][tag]['fname']) - - # Decompress files - for dl_fname in dl_files.values: - dl_fname = os.path.split(dl_fname)[1] - with zipfile.ZipFile(os.path.join(temp_dir.name, dl_fname), - 'r') as open_zip: - open_zip.extractall(data_path) - - # Cleanup temporary directory - temp_dir.cleanup() - return From 9f133de74ec3ca2da444be60026b3a3aef35734f Mon Sep 17 00:00:00 2001 From: Jeff Klenzing Date: Thu, 5 Oct 2023 10:33:14 -0400 Subject: [PATCH 2/3] DOC: update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8563e200..3f02a617 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/). -[0.2.0] - 2022-XX-XX +[0.2.0] - 2023-XX-XX -------------------- * Added support for access to TIEGCM models from the ICON mission * Maintenance From edb6f707c75ccf8225eb56d7da0921c463115914 Mon Sep 17 00:00:00 2001 From: Jeff Klenzing <19592220+jklenzing@users.noreply.github.com> Date: Thu, 29 Aug 2024 10:30:41 -0400 Subject: [PATCH 3/3] Update pysat_rc.yml --- .github/workflows/pysat_rc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pysat_rc.yml b/.github/workflows/pysat_rc.yml index 57113c3d..19054a67 100644 --- a/.github/workflows/pysat_rc.yml +++ b/.github/workflows/pysat_rc.yml @@ -6,7 +6,7 @@ name: Test with pysat ecosystem RCs -on: [workflow_dispatch] +on: [push] jobs: build: