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
4 changes: 2 additions & 2 deletions aodntools/ncwriter/imos_template.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from datetime import datetime
from pkg_resources import resource_filename
from pathlib import Path

from netCDF4 import num2date

from .template import DatasetTemplate

IMOS_GLOBAL_JSON = resource_filename(__name__, 'imos_global.json')
IMOS_GLOBAL_JSON = Path(__file__).parent / 'imos_global.json'
IMOS_GLOBAL_ATTRIBUTES = DatasetTemplate.from_json(IMOS_GLOBAL_JSON).global_attributes

TIMESTAMP_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
Expand Down
4 changes: 2 additions & 2 deletions aodntools/ncwriter/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json
import numpy as np
from jsonschema import validators, Draft4Validator, FormatChecker, ValidationError
from pkg_resources import resource_filename
from pathlib import Path

# helper function that will later be used to tell the schema validator how to validate objects of type "array"
def is_array(checker, instance):
Expand All @@ -31,7 +31,7 @@ def is_python_datatype(value):
return False

# Load JSON schema file
TEMPLATE_SCHEMA_JSON = resource_filename(__name__, 'template_schema.json')
TEMPLATE_SCHEMA_JSON = Path(__file__).parent / 'template_schema.json'
with open(TEMPLATE_SCHEMA_JSON) as f:
TEMPLATE_SCHEMA = json.load(f)

Expand Down
4 changes: 2 additions & 2 deletions aodntools/timeseries_products/aggregated_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
from copy import deepcopy
import json
import os
from pathlib import Path
import shutil
import tempfile

import numpy as np
import xarray as xr
from netCDF4 import Dataset, num2date, stringtochar
from pkg_resources import resource_filename

from aodntools import __version__
from aodntools.timeseries_products.common import (NoInputFilesError, check_file, in_water, current_utc_timestamp,
TIMESTAMP_FORMAT, DATESTAMP_FORMAT)

TEMPLATE_JSON = resource_filename(__name__, 'aggregated_timeseries_template.json')
TEMPLATE_JSON = Path(__file__).parent / 'aggregated_timeseries_template.json'


def sort_files(files_to_agg, input_dir=''):
Expand Down
5 changes: 2 additions & 3 deletions aodntools/timeseries_products/gridded_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
import bisect
import argparse
import os.path
from pathlib import Path
import json
from datetime import datetime, timezone
from collections import defaultdict

import xarray as xr
import pandas as pd

from pkg_resources import resource_filename

from aodntools import __version__
from aodntools.timeseries_products.common import current_utc_timestamp, TIMESTAMP_FORMAT, DATESTAMP_FORMAT
import aodntools.timeseries_products.aggregated_timeseries as TStools


TEMPLATE_JSON = resource_filename(__name__, 'gridded_timeseries_template.json')
TEMPLATE_JSON = Path(__file__).parent / 'gridded_timeseries_template.json'


def make_depth_bins(nc, increment=10):
Expand Down
8 changes: 4 additions & 4 deletions aodntools/timeseries_products/hourly_timeseries.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#!/usr/bin/env python3

import argparse
from collections import OrderedDict
import json
import os.path
from collections import OrderedDict
from pathlib import Path

import numpy as np
import pandas as pd
import xarray as xr
from dateutil.parser import parse
from pkg_resources import resource_filename

from aodntools import __version__
from aodntools.timeseries_products import aggregated_timeseries as utils
from aodntools.timeseries_products.common import (NoInputFilesError, check_file, get_qc_variable_names, in_water,
current_utc_timestamp, TIMESTAMP_FORMAT, DATESTAMP_FORMAT)

TEMPLATE_JSON = resource_filename(__name__, 'hourly_timeseries_template.json')
BINNING_METHOD_JSON = resource_filename(__name__, 'binning_method.json')
TEMPLATE_JSON = Path(__file__).parent / 'hourly_timeseries_template.json'
BINNING_METHOD_JSON = Path(__file__).parent / 'binning_method.json'


def check_files(file_list, site_code, parameter_names_accepted, input_dir=''):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import tempfile
import shutil
from copy import deepcopy
from pathlib import Path

from netCDF4 import Dataset, num2date, stringtochar
import numpy as np
import json
import argparse
from pkg_resources import resource_filename
from aodntools import __version__

import xarray as xr
Expand All @@ -16,7 +16,7 @@
from aodntools.timeseries_products.common import (NoInputFilesError, check_velocity_file, current_utc_timestamp,
TIMESTAMP_FORMAT, DATESTAMP_FORMAT)

TEMPLATE_JSON = resource_filename(__name__, 'velocity_aggregated_timeseries_template.json')
TEMPLATE_JSON = Path(__file__).parent / 'velocity_aggregated_timeseries_template.json'


def get_number_flatvalues(nc):
Expand Down
4 changes: 2 additions & 2 deletions aodntools/timeseries_products/velocity_hourly_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
import shutil
import tempfile
from copy import deepcopy
from pathlib import Path

import numpy as np
import pandas as pd
import xarray as xr
from netCDF4 import Dataset, num2date, stringtochar
from pkg_resources import resource_filename

import aodntools.timeseries_products.aggregated_timeseries as utils
from aodntools import __version__
from aodntools.timeseries_products.common import (NoInputFilesError, check_velocity_file, current_utc_timestamp,
TIMESTAMP_FORMAT, DATESTAMP_FORMAT)

TEMPLATE_JSON = resource_filename(__name__, 'velocity_hourly_timeseries_template.json')
TEMPLATE_JSON = Path(__file__).parent / 'velocity_hourly_timeseries_template.json'
QC_FLAG_MAX = 2
TIME_UNITS = "days since 1950-01-01 00:00:00 UTC"
TIME_CALENDAR = "gregorian"
Expand Down
Loading