Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
e974e8a
getPoci() returns np.nan incorrectly
wcarthur Apr 16, 2021
5365c17
track.ncReadTrackData returns true datetime objects
wcarthur Apr 22, 2021
f88ce28
GitHub actions (#111)
wcarthur Apr 22, 2021
ebf2473
Change build status badge to github actions
wcarthur Apr 22, 2021
0719a9f
Update DOI badge
wcarthur Apr 22, 2021
77fe6c6
Remove travis CI tests
wcarthur Apr 30, 2021
9ab8a26
Create tcrm-pylint.yml
wcarthur Apr 30, 2021
9edae9e
Update tcrm-pylint.yml
wcarthur Apr 30, 2021
46b38d4
Update tcrm-pylint.yml
wcarthur Apr 30, 2021
bef6838
Update tcrm-pylint.yml
wcarthur Apr 30, 2021
e3331af
Update tcrm-pylint.yml
wcarthur Apr 30, 2021
52e799c
Update tcrm-pylint.yml
wcarthur Apr 30, 2021
ed271db
Update tcrm-pylint.yml
wcarthur Apr 30, 2021
245d834
Update tcrm-pylint.yml
wcarthur Apr 30, 2021
ad20d46
Update tcrm-pylint.yml
wcarthur Apr 30, 2021
cc797b9
Update tcrm-tests.yml to include Python 3.9
wcarthur May 6, 2021
98d1492
Move definition statements to separate file
wcarthur May 7, 2021
96ab398
Merge branch 'develop' of github.com:GeoscienceAustralia/tcrm into de…
wcarthur May 7, 2021
c967de7
Move queries to separate file
wcarthur May 7, 2021
5d33126
Add readthedocs config file, update pylintrc
wcarthur Jul 9, 2021
b95ddc4
Validation (#115)
wcarthur Jul 9, 2021
5e8d138
Added an extra station
wcarthur Aug 20, 2021
d9ccb67
Additional locations
wcarthur Aug 26, 2021
501e4ba
Merge incoming changes
wcarthur Aug 26, 2021
f205f46
Nhirs 148 fix thread (#119)
mahmudulhasanGA Nov 3, 2021
091db2f
assertDictEqual doesn't like complex values (like arrays)
wcarthur Nov 8, 2021
9e82d3a
NHIRS-148: Fixed issue with FlushCache failing. (#121)
mahmudulhasanGA Nov 15, 2021
477c3a5
Enhancement/linear rmax (#125)
kieranricardo Jan 13, 2022
e40034a
adjust lam for storm direction
kieranricardo Jan 25, 2022
3d391a3
adjust lam for storm direction
kieranricardo Jan 25, 2022
3637dcf
adjust lam for storm direction
kieranricardo Jan 25, 2022
e7440d2
debug comment
kieranricardo Jan 26, 2022
90b29c5
update wind field model to get direction correct, and update document…
kieranricardo Jan 26, 2022
8ae25e5
add deleted lines back in
kieranricardo Jan 26, 2022
c5a1fac
add deleted lines back in
kieranricardo Jan 26, 2022
e7b15b3
Enhancement/linear rmax (#125)
kieranricardo Jan 13, 2022
12b7396
Merge branch 'develop' into bugfix/tests
wcarthur Jan 28, 2022
2d4a0c4
Update tcrm-tests.yml
wcarthur Jan 28, 2022
ba0761e
Change NumpyTestCase import statement
wcarthur Jan 28, 2022
82fb2c4
Merge branch 'bugfix/tests' of github.com:GeoscienceAustralia/tcrm in…
wcarthur Jan 28, 2022
6085be7
Tracing bug in cftime
wcarthur Feb 7, 2022
f703156
cftime bugs
wcarthur Feb 7, 2022
e248f4f
Force cartopy version in environment
wcarthur Feb 7, 2022
355d345
fix double calculation of t3 - it was previously L3 / (L2 * L2) inste…
kieranricardo Feb 15, 2022
03ed2da
extra debugging
kieranricardo Feb 16, 2022
b4223f3
extra debugging
kieranricardo Feb 16, 2022
1188c73
extra debugging
kieranricardo Feb 16, 2022
cca1310
extra debugging
kieranricardo Feb 16, 2022
3c4eee6
extra debugging
kieranricardo Feb 16, 2022
b788c37
Merge pull request #127 from GeoscienceAustralia/bugfix/tests
kieranricardo Feb 16, 2022
06e72dc
Merge branch 'develop' into bugfix/gevfit
kieranricardo Feb 16, 2022
84105f4
Merge branch 'develop' into bugfix/kerpert
kieranricardo Feb 16, 2022
f62886a
robust statistical test using scipy
kieranricardo Feb 16, 2022
2e22b2b
increase test precision so old incorrect fitting routine fails and ne…
kieranricardo Feb 16, 2022
cde392a
new test file
kieranricardo Feb 16, 2022
32e7b6b
add an xfail to flaky cftime failling tests
kieranricardo Feb 16, 2022
9ec9b9f
add an xfail to flaky cftime failling tests
kieranricardo Feb 16, 2022
1c1261a
Merge pull request #129 from GeoscienceAustralia/bugfix/gevfit
kieranricardo Feb 16, 2022
9f09324
Merge pull request #126 from GeoscienceAustralia/bugfix/kerpert
kieranricardo Feb 16, 2022
d6272de
Minor matplotlib updates
wcarthur Mar 7, 2022
b97be82
run tcrm from a pycxml file
kieranricardo Mar 16, 2022
cf3d91a
run tcrm from a pycxml file
kieranricardo Mar 16, 2022
b46f980
fixes
Mar 16, 2022
0479d31
handle negative central pressure deficits
Mar 16, 2022
384c072
revert example back
Mar 17, 2022
432f4c2
paralell tracks
kieranricardo Mar 18, 2022
8531923
Merge branch 'ensemble' of github.com:GeoscienceAustralia/tcrm into e…
kieranricardo Mar 18, 2022
ffdd8fb
xarray performance enhancements - 25% faster overall and 20x faster d…
Mar 21, 2022
6902a8c
faster fortran models
kieranricardo Mar 22, 2022
f296645
parallel fortran code
kieranricardo Mar 22, 2022
c157dcb
wip
Mar 22, 2022
bf1e5ea
Merge branch 'fortran-kepert' into ensemble
Mar 22, 2022
04a3358
parallel fortran code
kieranricardo Mar 23, 2022
138a5df
Merge branch 'fortran-kepert' into ensemble
Mar 23, 2022
e88c42e
parallel fortran code
kieranricardo Mar 23, 2022
2d85410
Merge branch 'fortran-kepert' into ensemble
Mar 23, 2022
9afd936
parallel fortran code
kieranricardo Mar 23, 2022
d0b46a4
slight optimizations
kieranricardo Mar 23, 2022
5e6c1bc
wip
Mar 23, 2022
975a59d
Merge branch 'fortran-kepert' into ensemble
Mar 23, 2022
4ed9931
put velocity and vorticity equations in same loop
kieranricardo Mar 23, 2022
0adba49
remove debug
Mar 23, 2022
0390952
Merge branch 'fortran-kepert' into ensemble
Mar 23, 2022
6c0eaac
cleanup memory
Mar 23, 2022
c6185ab
Remove double definition of iterable
wcarthur Sep 20, 2024
dcbe470
Remove old scipy imports
wcarthur Sep 20, 2024
c1b01ee
Enable MPI execution
wcarthur Sep 20, 2024
24e954c
Keep Port Hedland example, formatting changes
wcarthur Sep 24, 2024
aef97e5
new branch for TC-Lin tracks to wind hazard
LiangHuLiu Aug 7, 2025
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
34 changes: 34 additions & 0 deletions .github/workflows/tcrm-pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Pylint tests for TCRM

on:
push:
branches: [ master, develop ]

jobs:
build:
name: Pylint TCRM
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python env
uses: conda-incubator/[email protected]
with:
activate-environment: tcrm
environment-file: tcrmenv.yml
python-version: 3.7
auto-activate-base: false

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint --rcfile pylintrc --fail-under=7 `find -regextype egrep -regex '(.*.py)$'` |
tee pylint.txt
- name: Upload pylint.txt as artifact
uses: actions/upload-artifact@v2
with:
name: pylint report
path: pylint.txt
34 changes: 34 additions & 0 deletions .github/workflows/tcrm-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Unit tests for TCRM

on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]

jobs:
TCRM:
name: Test TCRM
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up environment
uses: conda-incubator/[email protected]
with:
activate-environment: tcrm
environment-file: tcrmenv.yml
python-version: ${{ matrix.python-version }}
auto-activate-base: false

- name: Test with pytest
env:
PYTHONPATH: ~/tcrm;~/tcrm/Utilities
shell: bash -l {0}
run: |
pytest -x --cov=. --cov-report xml
22 changes: 22 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
builder: html
configuration: conf.py

# Optionally build your docs in additional formats such as PDF
formats:
- pdf

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7

conda:
environment: tcrmenv.yml
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

20 changes: 20 additions & 0 deletions Evaluate/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1600,5 +1600,25 @@ def process_args(argv):

log.info("Completed {0}".format(sys.argv[0]))


def bom2tcrm(df, trackId):
"""
Transforms a dataframe in BoM format into a tcrm track.

"""
df['Datetime'] = pd.to_datetime(df.validtime)
df['Speed'] = df.translation_speed
df['CentralPressure'] = df.pcentre
df['Longitude'] = df.longitude
df['Latitude'] = df.latitude
df['EnvPressure'] = df.poci
df['rMax'] = df.rmax
df['trackId'] = df.disturbance.values

track = Track(df)
track.trackId = [trackId]
return track


if __name__ == '__main__':
process_args(sys.argv[1:])
40 changes: 33 additions & 7 deletions Evaluate/interpolateTracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
import numpy as np

from datetime import datetime, timedelta
from matplotlib.dates import num2date
from matplotlib.dates import num2date, date2num
from scipy.interpolate import interp1d, splev, splrep

from Utilities.maputils import latLon2Azi
from Utilities.loadData import loadTrackFile, maxWindSpeed
from Utilities.parallel import disableOnWorkers
from Utilities.track import Track, ncSaveTracks
from pycxml.pycxml import loadfile
import pandas as pd

LOG = logging.getLogger(__name__)
LOG.addHandler(logging.NullHandler())
Expand Down Expand Up @@ -70,7 +73,7 @@ def interpolate(track, delta, interpolation_type=None):
track.Minute)]
else:
day_ = track.Datetime

timestep = timedelta(delta/24.)
try:
time_ = np.array([d.toordinal() + (d.hour + d.minute/60.)/24.0
Expand All @@ -84,24 +87,24 @@ def interpolate(track, delta, interpolation_type=None):
else:
raise
dt_ = 24.0 * np.diff(time_)
dt = np.empty(len(track.data), dtype=float)
dt = np.zeros(len(track.data), dtype=float)
dt[1:] = dt_

# Convert all times to a time after initial observation:
timestep = 24.0*(time_ - time_[0])

newtime = np.arange(timestep[0], timestep[-1] + .01, delta)
newtime[-1] = timestep[-1]
_newtime = (newtime / 24.) + time_[0]

_newtime = (newtime / 24.) + time_[0] + date2num(np.datetime64('0000-12-31')) # Before Matplotlib 3.3, the epoch was 0000-12-31, later it changes to 1970-01-01 UTC
newdates = num2date(_newtime)
newdates = np.array([n.replace(tzinfo=None) for n in newdates])

if not hasattr(track, 'Speed'):
idx = np.zeros(len(track.data))
idx[0] = 1
# TODO: Possibly could change `np.mean(dt)` to `dt`?
track.WindSpeed = maxWindSpeed(idx, np.mean(dt), track.Longitude,
track.Latitude, track.CentralPressure,
track.Latitude, track.CentralPressure,
track.EnvPressure)
# Find the indices of valid pressure observations:
validIdx = np.where(track.CentralPressure < sys.maxsize)[0]
Expand Down Expand Up @@ -140,7 +143,7 @@ def interpolate(track, delta, interpolation_type=None):
# Use the Akima interpolation method:
try:
import akima
except ImportError:
except ModuleNotFoundError:
LOG.exception(("Akima interpolation module unavailable "
" - default to scipy.interpolate"))
nLon = splev(newtime, splrep(timestep, track.Longitude, s=0),
Expand Down Expand Up @@ -262,6 +265,7 @@ def saveTracks(tracks, outputFile):
if len(data) > 0:
np.savetxt(fp, data, fmt=OUTPUT_FMTS)

@disableOnWorkers
def parseTracks(configFile, trackFile, source, delta, outputFile=None,
interpolation_type=None):
"""
Expand Down Expand Up @@ -299,6 +303,9 @@ def parseTracks(configFile, trackFile, source, delta, outputFile=None,
if trackFile.endswith("nc"):
from Utilities.track import ncReadTrackData
tracks = ncReadTrackData(trackFile)
elif trackFile.endswith("xml"):
dfs = loadfile(trackFile)
tracks = [bom2tcrm(df, i) for i, df in enumerate(dfs)]
else:
tracks = loadTrackFile(configFile, trackFile, source)

Expand All @@ -317,3 +324,22 @@ def parseTracks(configFile, trackFile, source, delta, outputFile=None,


return results


def bom2tcrm(df, trackId):
"""
Transforms a dataframe in BoM format into a tcrm track.

"""
df['Datetime'] = pd.to_datetime(df.validtime)
df['Speed'] = df.translation_speed
df['CentralPressure'] = df.pcentre
df['Longitude'] = df.longitude
df['Latitude'] = df.latitude
df['EnvPressure'] = df.poci
df['rMax'] = df.rmax
df['trackId'] = df.disturbance.values

track = Track(df)
track.trackId = [trackId, trackId]
return track
Loading