@idm-plugin/meteo2 0.9.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,6 +29,7 @@ export interface OMParams {
29
29
  apikey?: string;
30
30
  fake?: boolean;
31
31
  fakes?: boolean[];
32
+ meta?: any;
32
33
  }
33
34
  /**
34
35
  * @see https://open-meteo.com/en/docs
@@ -44,9 +45,25 @@ export declare class MeteoHelper2 {
44
45
  private readonly SEASONAL;
45
46
  private METEO2_UPDATE;
46
47
  constructor(apikey: string, debug?: boolean);
48
+ /**
49
+ * 标准大气模式
50
+ */
47
51
  standardWeatherModels(): Promise<any>;
52
+ /**
53
+ * 标准海洋模式
54
+ */
48
55
  standardMarineModels(): Promise<any>;
56
+ /**
57
+ * 自动匹配大气模式和海洋模式
58
+ * @param model0
59
+ */
49
60
  autoPickMeteoModel(model0?: string): Promise<OMOptions>;
61
+ /**
62
+ * 生成指定范围内的数字序列
63
+ * @param start
64
+ * @param stop
65
+ * @param step
66
+ */
50
67
  static range(start: number, stop: number, step: number): number[];
51
68
  /**
52
69
  * 大气数据
@@ -55,9 +72,18 @@ export declare class MeteoHelper2 {
55
72
  * @param options
56
73
  */
57
74
  weatherForecast(params: any, callback: Function | undefined, options?: OMOptions): Promise<any[]>;
75
+ /**
76
+ * 尝试调用天气接口, 并解析数据
77
+ * @param url
78
+ * @param params
79
+ * @param callback
80
+ * @param fakeYear
81
+ * @param options
82
+ * @private
83
+ */
84
+ private tryToFetchWeatherApi;
58
85
  /**
59
86
  * 海洋数据
60
- *
61
87
  * Data Set | Region | Spatial Resolution | Temporal Resolution | Data Availability | Update frequency
62
88
  * MeteoFrance MFWAM | Global | 0.08° (~8 km) | 3-Hourly | October 2021 with 10 day forecast | Every 12 hours
63
89
  * MeteoFrance SMOC Currents, Tides & SST | Global | 0.08° (~8 km) | Hourly | January 2022 with 10 day | forecast Every 24 hours
@@ -73,9 +99,34 @@ export declare class MeteoHelper2 {
73
99
  */
74
100
  marineForecast(params: any, options?: OMOptions): Promise<any[]>;
75
101
  /**
76
- * 解析请求数据
102
+ * 尝试调用海洋接口
103
+ * @param url
104
+ * @param params
105
+ * @param options
106
+ * @private
107
+ */
108
+ private tryToFetchMarineApi;
109
+ /**
110
+ * 检查时间区间, 并调整为合理范围(不超时90天)
111
+ * @param startDate
112
+ * @param endDate
113
+ * @param options
114
+ * @private
115
+ */
116
+ private checkTimeInterval;
117
+ /**
118
+ * 从消息中提取时间区间, 并调整为合理范围
119
+ * @param message
120
+ * @param interval
121
+ * @param options
122
+ * @private
123
+ */
124
+ private matchDateRange;
125
+ /**
126
+ * 解析天气数据
77
127
  * @param rsps
78
128
  * @param params
129
+ * @param fakeYear 对应用前一年数据的预报进行时间调整
79
130
  * @param options
80
131
  * @private
81
132
  */
@@ -88,21 +139,49 @@ export declare class MeteoHelper2 {
88
139
  */
89
140
  private parseSeasonalDailyVariable;
90
141
  private mergeSegments;
142
+ /**
143
+ * 合并天气数据, 以IFS025为主, 并用IFS的能见度数据补全IFS025
144
+ * @param rows
145
+ * @private
146
+ */
91
147
  private mergeWeatherData;
148
+ /**
149
+ * 合并海洋数据, 以best_match为主, 并用meteofrance_currents的海流数据补全其他模型, 用ecmwf_wam的波浪数据补全meteofrance_wave, 用meteofrance_wave的波浪数据补全ecmwf_wam, 并对齐时间
150
+ * @param rows
151
+ * @param st
152
+ * @private
153
+ */
92
154
  private mergeMarineData;
155
+ /**
156
+ * 选择预报地址
157
+ * @param marine 是否为海洋预报
158
+ * @param selfHosted 是否自建服务,默认为true
159
+ * @param historical 是否为历史数据,默认为false,如果为true,则会使用历史数据接口
160
+ * @param options
161
+ * @private
162
+ */
93
163
  private pickForecastUrl;
164
+ /**
165
+ * 选择天气模型, 如果没有指定模型,则使用best_match,如果指定了模型,则按照优先级排序,并去重,确保ecmwf_ifs025和ecmwf_ifs同时存在
166
+ * @param models
167
+ * @private
168
+ */
94
169
  private pickWeatherModels;
170
+ /**
171
+ * 选择海洋模型, 如果没有指定模型,则使用best_match,如果指定了模型,则按照优先级排序,并去重,确保meteofrance_currents和ecmwf_wam025同时存在
172
+ * @param models
173
+ * @private
174
+ */
95
175
  private pickMarineModels;
96
176
  /**
97
- * 完善start_hour/end_hour 或者是forecast_days变量,二选一
98
- * @param datetime 从指定时间开始,不指定时从当前时间开始
99
- * @param marine 是否为海洋预报
100
- * @param params 要查询的要素
101
- * @param options 请求参数
177
+ * 构建公共参数
178
+ * @param datetime 指定预报开始时间,格式为ISO 8601字符串,例如"2024-01-01T00:00:00Z",不指定时从当前时间开始
179
+ * @param params
180
+ * @param options
102
181
  * @private
103
182
  */
104
183
  private prepare;
105
- private toStdLng;
184
+ static toStdLng(lng: number, precision?: number): number;
106
185
  private timezoneOffset;
107
186
  /**
108
187
  * 格式化时区
@@ -161,13 +240,20 @@ export declare class MeteoHelper2 {
161
240
  * @param lng
162
241
  * @param startDate
163
242
  * @param endDate
243
+ * @param withDaily
244
+ * @param withHourly
164
245
  * @param withMarine
165
246
  * @param options
166
247
  */
167
- spotHistorical(lat: number, lng: number, startDate: string, endDate: string, withDaily?: boolean, withHourly?: boolean, withMarine?: boolean, options?: OMOptions): Promise<{
168
- weather: any[];
169
- marine: any[] | undefined;
170
- }>;
248
+ spotHistorical(lat: number, lng: number, startDate: string, endDate: string, withDaily?: boolean, withHourly?: boolean, withMarine?: boolean, options?: OMOptions): Promise<any>;
249
+ /**
250
+ * Fetch historical data for a single date range
251
+ */
252
+ private _fetchHistoricalData;
253
+ /**
254
+ * Merge multiple historical data chunks
255
+ */
256
+ private _mergeHistoricalResults;
171
257
  /**
172
258
  * 季节预报数据
173
259
  * 提供未来45天~9个月的预报数据
@@ -203,9 +289,24 @@ export declare class MeteoHelper2 {
203
289
  * @param endDate
204
290
  * @param options
205
291
  */
206
- spotClimate(lat: number, lng: number, startDate: string, endDate: string | undefined, options?: OMOptions): Promise<{
207
- weather: any[];
208
- }>;
292
+ spotClimate(lat: number, lng: number, startDate: string, endDate: string | undefined, options?: OMOptions): Promise<any>;
293
+ /**
294
+ * Fetch climate data for a single date range
295
+ */
296
+ private _fetchClimateData;
297
+ /**
298
+ * Merge multiple climate data chunks
299
+ */
300
+ private _mergeClimateResults;
301
+ /**
302
+ * 更新模型信息,获取最新的模型更新时间和可用性等信息,避免使用过期的数据
303
+ * @param options
304
+ */
209
305
  update(options?: OMOptions): Promise<any>;
306
+ /**
307
+ * 选择需要更新的模型,按照更新时间排序,返回模型和更新时间等信息
308
+ * @param model
309
+ * @param options
310
+ */
210
311
  pickUpdateMeta(model: string | string[], options?: OMOptions): Promise<any[]>;
211
312
  }
@@ -13,7 +13,6 @@ export declare class TidesHelper {
13
13
  private readonly apikey;
14
14
  private readonly debug;
15
15
  constructor(apikey: string, debug?: boolean);
16
- private toStdLng;
17
16
  /**
18
17
  * 潮汐预报数据
19
18
  * @param lat
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@idm-plugin/meteo2",
3
3
  "private": false,
4
- "version": "0.9.9",
4
+ "version": "1.0.0",
5
5
  "description": "idm plugin for meteo2(open meteo)",
6
6
  "type": "module",
7
7
  "keywords": [
@@ -39,12 +39,12 @@
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@idm-plugin/geo2": "^1.4.7",
42
- "@idm-plugin/meteo": "^0.6.7",
42
+ "@idm-plugin/meteo": "^0.7.1",
43
43
  "@idm-plugin/tag": "^0.2.3"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@idm-plugin/geo2": "^1.4.7",
47
- "@idm-plugin/meteo": "^0.6.7",
47
+ "@idm-plugin/meteo": "^0.7.1",
48
48
  "@idm-plugin/tag": "^0.2.3",
49
49
  "@types/jest": "^25.2.2",
50
50
  "@types/node": "^18.14.2",