Skip to content

Commit 184a63c

Browse files
author
Caleb Dykman
committed
fix get example data function
1 parent 67d4806 commit 184a63c

File tree

5 files changed

+30
-18
lines changed

5 files changed

+30
-18
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## v1.0.2 (18/12/2022)
4+
5+
- Fix bug in get get_example_data.py
6+
7+
## v1.0.1 (17/12/2022)
8+
9+
- set dependencies in pyproject.toml as static
10+
311
## v1.0.0 (16/12/2022)
412

513
- Major update to regionalised daily sim nearby site selection.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pyraingen"
3-
version = "1.0.0"
3+
version = "1.0.2"
44
description = "A package for stochastically generating daily and subdaily rainfall in Australia with ifd constraining."
55
authors = ["Caleb Dykman"]
66
license = "None"

src/pyraingen/get_example_data.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ def get_example_data(dname=None, daily=True, subdaily=True, ifd=True):
2525
dname = os.getcwd()
2626

2727
if daily == True:
28-
with resources.path("pyraingen.data.example.daily", "daily.nc") as f:
28+
with resources.path("pyraingen.data.example.daily", "rev_dr061003.txt") as f:
2929
src_pth = str(f)
30-
source_dir = src_pth[:-14]
30+
source_dir = src_pth[:-16]
3131
shutil.copytree(source_dir, dname+"/daily")
3232

3333
if subdaily == True:
34-
with resources.path("pyraingen.data.example.subdaily", "subdaily.nc") as f:
34+
with resources.path("pyraingen.data.example.subdaily", "daily.nc") as f:
3535
src_pth = str(f)
36-
source_dir = src_pth[:-16]
36+
source_dir = src_pth[:-8]
3737
shutil.copytree(source_dir, dname+"/subdaily")
3838

3939
if ifd == True:
40-
with resources.path("pyraingen.data.example.ifd", "condsubdaily.nc") as f:
40+
with resources.path("pyraingen.data.example.ifd", "subdaily.nc") as f:
4141
src_pth = str(f)
42-
source_dir = src_pth[:-18]
42+
source_dir = src_pth[:-11]
4343
shutil.copytree(source_dir, dname+"/ifd")
4444

4545
print("Copied")

src/pyraingen/regionalisedsubdailysim.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ def regionalisedsubdailysim(fnameInput, pathSubDaily, targetIndex,
5757
absDiffTol=0.1, gso3_lat=None, gso3_lon=None,
5858
gso3_elev=None, gso3_distcoast=None,
5959
gso3_anrf=None, gso3_temp=None):
60-
"""Front end to the regionalised sub-daily
61-
disaggregation code.
60+
"""Front end to the regionalised sub-daily disaggregation code.
6261
6362
Options (genSeqOption) included:\n
6463
0. Only sub daily data is available.
6564
- Daily data is formed from the subdaily record and is used for disaggregation.\n
66-
1. Daily and sub-daily rainfall data at target station is available \n(daily record comes from other source and therefore may be of different length to sub-daily record).
65+
1. Daily and sub-daily rainfall data at target station is available \n
66+
- daily record comes from other source and therefore may be of different length to sub-daily record.\n
6767
- using sub-daily record at target station to disaggregate the daily record at the target station.\n
6868
2. Only daily rainfall at target station is available
6969
- using nearby locations sub-daily information disaggregate daily rainfall at target location.\n
@@ -74,10 +74,10 @@ def regionalisedsubdailysim(fnameInput, pathSubDaily, targetIndex,
7474
4. Multiple simulated sequences of daily rainfall at the target station are available.
7575
- sub daily rainfall sequences are generated using sub-daily information at the target station.\n
7676
77-
Step 1: Pre-Compute the Pool - Mix of Step 1 and 2 in Westra et al
78-
2012 "Continuous rainfall simulation 1: A regionalised subdaily
79-
disaggregation approach". This depends on the user's input of
80-
genSeqOption. Different sequences are generated for each season, because if
77+
Step 1: Pre-Compute the Pool - Mix of Step 1 and 2 in Westra et al 2012
78+
"Continuous rainfall simulation 1: A regionalised subdaily disaggregation approach".
79+
This depends on the user's input of genSeqOption.
80+
Different sequences are generated for each season, because if
8181
genSeqOption = 3 then there may be different stations per
8282
season. However, if the target data is known (genSeqOption <= 2)
8383
then it is the same data set for each season. Finally, if if there is
@@ -89,14 +89,14 @@ def regionalisedsubdailysim(fnameInput, pathSubDaily, targetIndex,
8989
the method of fragments is only concerned with one parameter that can be computed up
9090
front:
9191
92-
1) the day of the year the rain fell, e.g. November 23rd, and not which
93-
year and the where is already handled with the "nearby" stations".
92+
1) the day of the year the rain fell, e.g. November 23rd, and not which
93+
year and the where is already handled with the "nearby" stations".
9494
9595
The second logical must be computed sliding through the target daily
9696
series:
9797
98-
2) a logical if the wet states for the previous and next day are the
99-
same as from the target daily sequence.
98+
2) a logical if the wet states for the previous and next day are the
99+
same as from the target daily sequence.
100100
101101
The general process is then to loop over the seasons and then each station
102102
within that season. From there we compute the sequences.
@@ -115,6 +115,7 @@ def regionalisedsubdailysim(fnameInput, pathSubDaily, targetIndex,
115115
Step 2 b) Dissagregation Loop
116116
117117
Save Data
118+
118119
119120
Parameters
120121
----------

tests/test_getexampledata.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from pyraingen.get_example_data import get_example_data
2+
3+
get_example_data(daily=True, subdaily=True, ifd=True)

0 commit comments

Comments
 (0)