Skip to content

Commit

Permalink
add three hourly data for ecmwf
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-zippenfenig committed Oct 23, 2023
1 parent 1b813f2 commit 23cbc40
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
2 changes: 2 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

AWK is used to remove create functions for flatbuffer messages

Note: Python code is modified to add selector functions. Make sure to keep changes after compiling

```bash
flatc --swift -o swift/Sources/OpenMeteoSdk/ flatbuffers/*.fbs

Expand Down
1 change: 1 addition & 0 deletions flatbuffers/openmeteo_sdk.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ table ApiResponse {
current: SeriesAndTime;
daily: SeriesAndTime;
hourly: SeriesAndTime;
three_hourly: SeriesAndTime;
six_hourly: SeriesAndTime;
minutely_15: SeriesAndTime;
}
Expand Down
14 changes: 12 additions & 2 deletions python/openmeteo_sdk/ApiResponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def Hourly(self) -> Optional[SeriesAndTime]:
return None

# ApiResponse
def SixHourly(self) -> Optional[SeriesAndTime]:
def ThreeHourly(self) -> Optional[SeriesAndTime]:
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
Expand All @@ -131,7 +131,7 @@ def SixHourly(self) -> Optional[SeriesAndTime]:
return None

# ApiResponse
def Minutely15(self) -> Optional[SeriesAndTime]:
def SixHourly(self) -> Optional[SeriesAndTime]:
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
Expand All @@ -140,4 +140,14 @@ def Minutely15(self) -> Optional[SeriesAndTime]:
return obj
return None

# ApiResponse
def Minutely15(self) -> Optional[SeriesAndTime]:
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
obj = SeriesAndTime()
obj.Init(self._tab.Bytes, x)
return obj
return None


12 changes: 9 additions & 3 deletions swift/Sources/OpenMeteoSdk/openmeteo_sdk_generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,9 @@ public struct openmeteo_sdk_ApiResponse: FlatBufferObject, Verifiable {
case current = 22
case daily = 24
case hourly = 26
case sixHourly = 28
case minutely15 = 30
case threeHourly = 28
case sixHourly = 30
case minutely15 = 32
var v: Int32 { Int32(self.rawValue) }
var p: VOffset { self.rawValue }
}
Expand All @@ -441,9 +442,10 @@ public struct openmeteo_sdk_ApiResponse: FlatBufferObject, Verifiable {
public var current: openmeteo_sdk_SeriesAndTime? { let o = _accessor.offset(VTOFFSET.current.v); return o == 0 ? nil : openmeteo_sdk_SeriesAndTime(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
public var daily: openmeteo_sdk_SeriesAndTime? { let o = _accessor.offset(VTOFFSET.daily.v); return o == 0 ? nil : openmeteo_sdk_SeriesAndTime(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
public var hourly: openmeteo_sdk_SeriesAndTime? { let o = _accessor.offset(VTOFFSET.hourly.v); return o == 0 ? nil : openmeteo_sdk_SeriesAndTime(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
public var threeHourly: openmeteo_sdk_SeriesAndTime? { let o = _accessor.offset(VTOFFSET.threeHourly.v); return o == 0 ? nil : openmeteo_sdk_SeriesAndTime(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
public var sixHourly: openmeteo_sdk_SeriesAndTime? { let o = _accessor.offset(VTOFFSET.sixHourly.v); return o == 0 ? nil : openmeteo_sdk_SeriesAndTime(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
public var minutely15: openmeteo_sdk_SeriesAndTime? { let o = _accessor.offset(VTOFFSET.minutely15.v); return o == 0 ? nil : openmeteo_sdk_SeriesAndTime(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
public static func startApiResponse(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 14) }
public static func startApiResponse(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 15) }
public static func add(latitude: Float32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: latitude, def: 0.0, at: VTOFFSET.latitude.p) }
public static func add(longitude: Float32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: longitude, def: 0.0, at: VTOFFSET.longitude.p) }
public static func add(elevation: Float32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: elevation, def: 0.0, at: VTOFFSET.elevation.p) }
Expand All @@ -456,6 +458,7 @@ public struct openmeteo_sdk_ApiResponse: FlatBufferObject, Verifiable {
public static func add(current: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: current, at: VTOFFSET.current.p) }
public static func add(daily: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: daily, at: VTOFFSET.daily.p) }
public static func add(hourly: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: hourly, at: VTOFFSET.hourly.p) }
public static func add(threeHourly: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: threeHourly, at: VTOFFSET.threeHourly.p) }
public static func add(sixHourly: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: sixHourly, at: VTOFFSET.sixHourly.p) }
public static func add(minutely15: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: minutely15, at: VTOFFSET.minutely15.p) }
public static func endApiResponse(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end }
Expand All @@ -473,6 +476,7 @@ public struct openmeteo_sdk_ApiResponse: FlatBufferObject, Verifiable {
currentOffset current: Offset = Offset(),
dailyOffset daily: Offset = Offset(),
hourlyOffset hourly: Offset = Offset(),
threeHourlyOffset threeHourly: Offset = Offset(),
sixHourlyOffset sixHourly: Offset = Offset(),
minutely15Offset minutely15: Offset = Offset()
) -> Offset {
Expand All @@ -489,6 +493,7 @@ public struct openmeteo_sdk_ApiResponse: FlatBufferObject, Verifiable {
openmeteo_sdk_ApiResponse.add(current: current, &fbb)
openmeteo_sdk_ApiResponse.add(daily: daily, &fbb)
openmeteo_sdk_ApiResponse.add(hourly: hourly, &fbb)
openmeteo_sdk_ApiResponse.add(threeHourly: threeHourly, &fbb)
openmeteo_sdk_ApiResponse.add(sixHourly: sixHourly, &fbb)
openmeteo_sdk_ApiResponse.add(minutely15: minutely15, &fbb)
return openmeteo_sdk_ApiResponse.endApiResponse(&fbb, start: __start)
Expand All @@ -508,6 +513,7 @@ public struct openmeteo_sdk_ApiResponse: FlatBufferObject, Verifiable {
try _v.visit(field: VTOFFSET.current.p, fieldName: "current", required: false, type: ForwardOffset<openmeteo_sdk_SeriesAndTime>.self)
try _v.visit(field: VTOFFSET.daily.p, fieldName: "daily", required: false, type: ForwardOffset<openmeteo_sdk_SeriesAndTime>.self)
try _v.visit(field: VTOFFSET.hourly.p, fieldName: "hourly", required: false, type: ForwardOffset<openmeteo_sdk_SeriesAndTime>.self)
try _v.visit(field: VTOFFSET.threeHourly.p, fieldName: "threeHourly", required: false, type: ForwardOffset<openmeteo_sdk_SeriesAndTime>.self)
try _v.visit(field: VTOFFSET.sixHourly.p, fieldName: "sixHourly", required: false, type: ForwardOffset<openmeteo_sdk_SeriesAndTime>.self)
try _v.visit(field: VTOFFSET.minutely15.p, fieldName: "minutely15", required: false, type: ForwardOffset<openmeteo_sdk_SeriesAndTime>.self)
_v.finish()
Expand Down
9 changes: 7 additions & 2 deletions ts/api-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,19 @@ hourly(obj?:SeriesAndTime):SeriesAndTime|null {
return offset ? (obj || new SeriesAndTime()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}

sixHourly(obj?:SeriesAndTime):SeriesAndTime|null {
threeHourly(obj?:SeriesAndTime):SeriesAndTime|null {
const offset = this.bb!.__offset(this.bb_pos, 28);
return offset ? (obj || new SeriesAndTime()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}

minutely15(obj?:SeriesAndTime):SeriesAndTime|null {
sixHourly(obj?:SeriesAndTime):SeriesAndTime|null {
const offset = this.bb!.__offset(this.bb_pos, 30);
return offset ? (obj || new SeriesAndTime()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}

minutely15(obj?:SeriesAndTime):SeriesAndTime|null {
const offset = this.bb!.__offset(this.bb_pos, 32);
return offset ? (obj || new SeriesAndTime()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}

}

0 comments on commit 23cbc40

Please sign in to comment.