stemflow.utils.sphere_quadtree
A function module to get quadtree results for spherical indexing system. Twins to quadtree.py
, Returns ensemble_df and plotting axes.
get_one_ensemble_sphere_quadtree(ensemble_count, data, Temporal1='DOY', grid_len_upper_threshold=8000, grid_len_lower_threshold=500, points_lower_threshold=50, temporal_start=1, temporal_end=366, temporal_step=20, temporal_bin_interval=50, temporal_bin_start_jitter='adaptive', spatio_bin_jitter_magnitude='adaptive', save_gridding_plotly=True, save_gridding_plot=False, ax=None, radius=6371.0, plot_empty=False, rng=None)
Generate QuadTree gridding based on the input dataframe
A function to get quadtree results for spherical indexing system. Twins to get_ensemble_quadtree
in quadtree.py
, Returns ensemble_df and plotting axes.
Parameters:
-
data
(DataFrame
) –Input pandas-like dataframe
-
Temporal1
(str
, default:'DOY'
) –Temporal column name 1 in data
-
size
–How many ensemble to generate (how many round the data are gone through)
-
grid_len_upper_threshold
(Union[float, int]
, default:8000
) –force divide if grid longitude larger than the threshold (in km)
-
grid_len_lower_threshold
(Union[float, int]
, default:500
) –stop divide if grid longitude will be below than the threshold (in km)
-
points_lower_threshold
(int
, default:50
) –Do not train the model if the available data records for this stixel is less than this threshold, and directly set the value to np.nan.
-
temporal_start
(Union[float, int]
, default:1
) –start of the temporal sequence
-
temporal_end
(Union[float, int]
, default:366
) –end of the temporal sequence
-
temporal_step
(Union[float, int]
, default:20
) –step of the sliding window
-
temporal_bin_interval
(Union[float, int]
, default:50
) –size of the sliding window
-
temporal_bin_start_jitter
(Union[float, int, str]
, default:'adaptive'
) –jitter of the start of the sliding window. If 'adaptive', a adaptive jitter of range (-bin_interval, 0) will be generated for the start.
-
spatio_bin_jitter_magnitude
(Union[float, int]
, default:'adaptive'
) –jitter of the spatial gridding.
-
save_gridding_plotly
(bool
, default:True
) –Whether to save the plotly interactive gridding plot.
-
save_gridding_plot
(bool
, default:False
) –Whether ot save gridding plots
-
ax
–Matplotlib Axes to add to.
-
radius
(Union[int, float]
, default:6371.0
) –The radius of earth in km. Defaults to 6371.0.
-
rng
(Generator
, default:None
) –random number generator.
Returns:
-
–
A tuple of
1. ensemble dataframe;
2. grid plot. np.nan if save_gridding_plot=False
Source code in stemflow/utils/sphere_quadtree.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|