Skip to content

Commit 6aa35ec

Browse files
Iss12 (#15)
* Daymet dataset added, * Bumping version to `v0.2.0`.
1 parent 03d742f commit 6aa35ec

10 files changed

+1326
-2
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
.git
33
.ipynb_checkpoints
44
.DS_Store
5-
5+
*.swp

CHANGELOG

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Changelog
2+
=========
3+
4+
[v0.2.0] - May 5th, 2023
5+
6+
# Added
7+
* `Daymet` dataset based on https://daymet.ornl.gov/overview.
8+
9+
# Changed
10+
* not applicable
11+
12+
# Fixed
13+
* not applicable

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0
1+
0.2.0

assets/coord_closest_daymet_idx.ncl

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
; Meteorological Data Processing Workflow
2+
; Copyright (C) 2022, University of Saskatchewan
3+
; Copyright (C) 2023, University of Calgary
4+
;
5+
; This file is part of Meteorological Data Processing Workflow
6+
;
7+
; This program is free software: you can redistribute it and/or modify
8+
; it under the terms of the GNU General Public License as published by
9+
; the Free Software Foundation, either version 3 of the License, or
10+
; (at your option) any later version.
11+
;
12+
; This program is distributed in the hope that it will be useful,
13+
; but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
; GNU General Public License for more details.
16+
;
17+
; You should have received a copy of the GNU General Public License
18+
; along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
20+
; usage:
21+
; ncl 'coord_file="./path/to/wrf/coordinate/file.nc"' \
22+
; 'minlat=float' \
23+
; 'maxlat=float' \
24+
; 'minlon=float' \
25+
; 'maxlon=float' \
26+
; coord_wrf_idx.ncl;
27+
28+
;---suppress errors including fatal ones
29+
err = NhlGetErrorObjectId()
30+
31+
setvalues err
32+
"errPrint" : "False"
33+
end setvalues
34+
35+
;---coordinate variable path and and name must be entered as input arguments
36+
a = addfile(coord_file,"r")
37+
glat2d = a->lat
38+
glon2d = a->lon
39+
40+
;---variable names below should be defined as input arguments
41+
; minlat
42+
; maxlat
43+
; minlon
44+
; maxlon
45+
; print("coord_file: "+coord_file)
46+
; print("minlat: "+minlat)
47+
; print("maxlat: "+maxlat)
48+
; print("minlon: "+minlon)
49+
; print("maxlon: "+maxlon)
50+
51+
;---building arrays for getind_latlon2d () function
52+
lat = (/ minlat, maxlat /)
53+
lon = (/ minlon, maxlon /)
54+
55+
;---Get xy indexes, and then use these to get lat/lon values back again.
56+
opt = True
57+
loc = getind_latlon2d (glat2d, glon2d, lat, lon)
58+
59+
;---print the following array: [minlonidx, maxlonidx, minlatidx, maxlatidx]
60+
minlonidx = min(loc(:, 1))
61+
maxlonidx = max(loc(:, 1))
62+
minlatidx = min(loc(:, 0))
63+
maxlatidx = max(loc(:, 0))
64+
print(minlonidx+","+maxlonidx)
65+
print(minlatidx+","+maxlatidx)
66+
;---END

assets/coord_daymet_idx.ncl

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
; Meteorological Data Processing Workflow
2+
; Copyright (C) 2022, University of Saskatchewan
3+
; Copyright (C) 2023, University of Calgary
4+
;
5+
; This file is part of Meteorological Data Processing Workflow
6+
;
7+
; This program is free software: you can redistribute it and/or modify
8+
; it under the terms of the GNU General Public License as published by
9+
; the Free Software Foundation, either version 3 of the License, or
10+
; (at your option) any later version.
11+
;
12+
; This program is distributed in the hope that it will be useful,
13+
; but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
; GNU General Public License for more details.
16+
;
17+
; You should have received a copy of the GNU General Public License
18+
; along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
20+
; usage:
21+
; ncl 'coord_file="./path/to/wrf/coordinate/file.nc"' \
22+
; 'minlat=float' \
23+
; 'maxlat=float' \
24+
; 'minlon=float' \
25+
; 'maxlon=float' \
26+
; coord_wrf_idx.ncl;
27+
28+
;---suppress errors including fatal ones
29+
err = NhlGetErrorObjectId()
30+
31+
setvalues err
32+
"errPrint" : "False"
33+
end setvalues
34+
35+
;---coordinate variable path and and name must be entered as input arguments
36+
a = addfile(coord_file,"r")
37+
glat2d = a->lat
38+
glon2d = a->lon
39+
40+
;---variable names below should be defined as input arguments
41+
; minlat
42+
; maxlat
43+
; minlon
44+
; maxlon
45+
; print("coord_file: "+coord_file)
46+
; print("minlat: "+minlat)
47+
; print("maxlat: "+maxlat)
48+
; print("minlon: "+minlon)
49+
; print("maxlon: "+maxlon)
50+
51+
;---Get xy indexes, and then use these to get lat/lon values back again.
52+
opt = True
53+
loc = region_ind (glat2d, glon2d, minlat, maxlat, minlon, maxlon)
54+
55+
;---print ERROR and exit of spatial index are out of range
56+
if (.not. all(loc)) then
57+
print("ERROR")
58+
exit
59+
end if
60+
61+
;---print the following box of data: [minlonidx, maxlonidx, minlatidx, maxlatidx]
62+
minlonidx = loc(2)
63+
maxlonidx = loc(3)
64+
minlatidx = loc(0)
65+
maxlatidx = loc(1)
66+
print(minlonidx+","+maxlonidx)
67+
print(minlatidx+","+maxlatidx)
68+
;---END

0 commit comments

Comments
 (0)