Skip to content

Commit a0f9b19

Browse files
authored
Pass lat-lon points to BallTree instead of lon-lat (#439)
1 parent e1e1065 commit a0f9b19

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

python/extpar_art_to_buffer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
from namelist import input_art as iart
2929

3030

31-
def get_neighbor_index(index, hlon, hlat, idxs, ones, balltree):
32-
points = np.column_stack((hlon, hlat[index] * ones))
31+
def get_neighbor_index(index, hlat, hlon, idxs, ones, balltree):
32+
points = np.column_stack((hlat[index] * ones, hlon))
3333
idxs[index, :] = balltree.query(points, k=1)[1].squeeze()
3434

3535

@@ -200,14 +200,14 @@ def get_fraction_per_soil_type(soil_id):
200200
)
201201
logging.info("")
202202

203-
lon_lat_array = np.column_stack((lons.ravel(), lats.ravel()))
204-
balltree = BallTree(lon_lat_array, metric="haversine", leaf_size=3)
203+
lat_lon_array = np.column_stack((lats.ravel(), lons.ravel()))
204+
balltree = BallTree(lat_lon_array, metric="haversine", leaf_size=3)
205205

206206
ones = np.ones((raw_lon.size))
207207

208208
nrows = np.arange(raw_lat.size)
209209
Parallel(n_jobs=omp, max_nbytes='100M', mmap_mode='w+')(delayed(
210-
get_neighbor_index)(i, raw_lon, raw_lat, neighbor_ids, ones, balltree)
210+
get_neighbor_index)(i, raw_lat, raw_lon, neighbor_ids, ones, balltree)
211211
for i in tqdm(nrows))
212212

213213
# --------------------------------------------------------------------------

test/testsuite/data/get_data.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,38 @@ fi
1414
# mch
1515
test -d mch || exit 1
1616
cd mch/c7_globe
17-
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_mch_c7_PR435.nc'
17+
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_mch_c7_PR439.nc'
1818
cd -
1919

2020
test -d mch || exit 1
2121
cd mch/c1_aster
22-
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_mch_c1_PR435.nc'
22+
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_mch_c1_PR439.nc'
2323
cd -
2424

2525
# clm
2626
test -d clm || exit 1
2727
cd clm/12km_globe
28-
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_12km_globe_PR435.nc'
28+
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_12km_globe_PR439.nc'
2929
cd -
3030

3131
cd clm/ecoclimap_sg
3232
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/icon_grid_bolivia.nc'
33-
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_icon_eco_PR435.nc'
33+
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_icon_eco_PR439.nc'
3434
cd -
3535

3636
# dwd
3737
test -d dwd || exit 1
3838

3939
cd dwd/icon_d2
4040
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/icon_grid_DOM01.nc'
41-
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_icon_d2_PR435.nc'
41+
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_icon_d2_PR439.nc'
4242
cd -
4343

4444
cd dwd/icon_ecci
4545
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/icon_grid_bolivia.nc'
4646
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/clim_t2m_icon_ecci.nc'
4747
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/clim_tsea_icon_ecci.nc'
48-
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_icon_ecci_PR435.nc'
48+
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_icon_ecci_PR439.nc'
4949
cd -
5050

5151
# mpim
@@ -54,14 +54,14 @@ cd mpim/icon_r2b4
5454
wget --quiet 'http://icon-downloads.mpimet.mpg.de/grids/public/mpim/0013/icon_grid_0013_R02B04_G.nc'
5555
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/clim_t2m_icon_r2b4.nc'
5656
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/clim_tsea_icon_r2b4.nc'
57-
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_icon_mpim_PR435.nc'
57+
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/external_parameter_icon_mpim_PR439.nc'
5858
cd -
5959

6060
# ecmwf
6161
test -d ecmwf || exit 1
6262
cd ecmwf/corine_icon
6363
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/corine/icon_grid_0099_R19B10.nc'
64-
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/corine/external_parameter_icon_corine_PR435.nc'
64+
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/corine/external_parameter_icon_corine_PR439.nc'
6565
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/corine/clim_tsea_corine.nc'
6666
wget --quiet 'ftp://iacftp.ethz.ch/pub_read/stelliom/corine/clim_t2m_corine.nc'
6767
cd -

0 commit comments

Comments
 (0)