Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cdm location #54

Closed
wants to merge 6 commits into from
Closed
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/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
with:
repository: ecmwf-projects/cdm-obs.git
ref: 'new-variables'
path: common_data_model
path: cdm-obs
- name: Download cads-forms-insitu
env:
BITBUCKET_TOKEN: ${{ secrets.BITBUCKET_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion cdsobs/cdm/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def open_asset(cdm_netcdf: str, decode_variables: bool = False) -> xarray.Datase


def read_cdm_code_table(cdm_tables_location: Path, name: str) -> CDMCodeTable:
table_path = Path(cdm_tables_location, f"common_data_model/tables/{name}.dat")
table_path = Path(cdm_tables_location, f"cdm-obs/tables/{name}.dat")
table_data = pandas.read_csv(
table_path,
delimiter="\t",
Expand Down
6 changes: 2 additions & 4 deletions cdsobs/cdm/tables.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Define a table for the variable-group-matching - for now just a dict:
# I do not know all those variables, so some might be in the wrong group - please
# have a look at: https://github.com/glamod/common_data_model/tree/master/table_definitions
# have a look at: https://github.com/ecmwf-projects/cdm-obs/tree/master/table_definitions
# to create the table for the matching observations_table - contains all the
# observations - one row for each observation moment
import warnings
Expand Down Expand Up @@ -176,9 +176,7 @@ def read_cdm_table(cdm_tables_location: Path, name: str) -> CDMTable:
-------
CDMTable object which contains the name and a pandas.DataFrame with the data.
"""
table_path = Path(
cdm_tables_location, f"common_data_model/table_definitions/{name}.csv"
)
table_path = Path(cdm_tables_location, f"cdm-obs/table_definitions/{name}.csv")
table_data = pandas.read_csv(
table_path,
delimiter="\t",
Expand Down
4 changes: 3 additions & 1 deletion cdsobs/cli/_copy_dataset.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from io import BytesIO
from pathlib import Path
from tempfile import NamedTemporaryFile
Expand Down Expand Up @@ -248,8 +249,9 @@ def copy_object(object_url):
name = object_url.split("/")[-1]
response = requests.get(object_url, stream=True)
response.raise_for_status()
tmp_base = "/tmp" if os.getenv("GITHUB_ACTIONS") else "/dev/shm"
with (
NamedTemporaryFile(dir="/dev/shm") as ntf,
NamedTemporaryFile(dir=tmp_base) as ntf,
BytesIO(response.content) as bc,
):
ntf.write(bc.read())
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_cli_make_production(verbose):
assert result.exit_code == 0


# @pytest.mark.skip(reason="this test does not reset db after running")
@pytest.mark.skip(reason="this test does not reset db after running")
def test_cli_retrieve(tmp_path, test_repository):
runner = CliRunner()
test_json_str = """[
Expand Down
2 changes: 2 additions & 0 deletions tests/cli/test_copy_delete_dataset.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pytest
from typer.testing import CliRunner

from cdsobs.cli._copy_dataset import s3_export
Expand Down Expand Up @@ -51,6 +52,7 @@ def test_copy_delete_dataset_inside(test_repository, test_config):
assert len(list(test_repository.s3_client.list_directory_objects(dest_bucket))) == 1


@pytest.mark.skip(reason="this test does get stuck in github CI for some reason")
def test_s3_export(test_repository):
entries = test_repository.catalogue_repository.get_by_dataset(DS_TEST_NAME)
s3_export(test_repository.s3_client, test_repository.s3_client, entries, "test")
Expand Down
Loading