Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pysat_rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

name: Test with pysat ecosystem RCs

on: [workflow_dispatch]
on: [push]

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 5 additions & 26 deletions pysatModels/models/ucar_tiegcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
import functools
import os
import pandas as pds
import tempfile
import warnings
import zipfile

import pysat

Expand Down Expand Up @@ -211,10 +209,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
Expand All @@ -229,7 +228,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
Expand All @@ -246,29 +245,9 @@ def download(date_array, tag, inst_id, data_path=None, **kwargs):
warnings.warn('Not implemented, currently no support for Globus.')
# TODO(#132): Ensure new download routine is used after pysatNASA release.
elif tag == 'icon':
warnings.warn('Not implemented, requires pysatNASA 0.0.6.')
elif tag == 'future_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


Expand Down
Loading