Closed hongyuanjia closed 2 years ago
Merging #45 (44fadff) into master (76ff383) will increase coverage by
0.00%
. The diff coverage is100.00%
.:exclamation: Current head 44fadff differs from pull request most recent head e940a4f. Consider uploading reports for the commit e940a4f to get more accurate results
@@ Coverage Diff @@
## master #45 +/- ##
=======================================
Coverage 99.81% 99.81%
=======================================
Files 5 5
Lines 1063 1084 +21
=======================================
+ Hits 1061 1082 +21
Misses 2 2
Impacted Files | Coverage Δ | |
---|---|---|
R/utils.R | 100.00% <ø> (ø) |
|
R/coord.R | 100.00% <100.00%> (ø) |
|
R/morph.R | 100.00% <100.00%> (ø) |
|
R/netcdf.R | 99.33% <100.00%> (+<0.01%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 76ff383...e940a4f. Read the comment docs.
Pull request overview
match_coord()
has been refactored to correct the calculation method of geographical distance. Previously, epwshiftr assumes that distance on longitude and latitude is the same which is not true. Now it uses a spheroid formula to calculate the tunnel distance. For details, please see Tunnel Distance . The structure of the returnedepw_cmip6_coord
object has also changed. Thecoord
column in thecoord
data.table
is also adata.table
which contains 6 columns describing the matched coordinates:index
: the indices of matched coordinatesind_lon
,ind_lat
: The value indices of longitude or latitude in the NetCDF coordinate grids. These values are used to extract the corresponding variable valueslon
,lat
: the actual longitude or latitude in the NetCDF coordinate gridsdist
: the distance in km between the coordinate values in NetCDF and input EPWBesides, the usage of the input
threshold
andmax_num
has been changed a little bit:threshold
: Due to the change in distance calculation, the meaning of thethreshold
input has been changed. Instead of directly being used to get the 'closest' grid points in NetCDF, the longitude and latitude threshold is only used to help exclude grid points that are definitely too far away from the target location. The default threshold, which is 1 degree for both longitude and latitude, is still reasonable for common use cases and is kept unchanged. Alsothreshold
now can be set toNULL
. In this case, the distances between the target location and all grid points will be calculated. But this may be only useful for rare cases.max_num
: Now the valuemax_num
is the key input to control how many grid points are to be matched. The points will always be ordered in descending order in terms of the distances.The
data
in the returned value ofextract_data()
has been updated to include a new columndist
which gives the spherical distance in km between EPW location and grid coordinates.The document on the return value structure for
extract_data()
andmorphing_epw()
has been fixed (#29). And the column order for all metadata in the returneddata.table
fromextract_data()
andmorphing_epw()
are not consistent. The columns will always be in the order below:activity_drs
institution_id
source_id
experiment_id
member_id
table_id
lon
lat
dist