Skip to content

Add support for reading float arrays#27

Open
Silas217209 wants to merge 4 commits into
ScaleWeather:mainfrom
Silas217209:add-f32-array-decoding
Open

Add support for reading float arrays#27
Silas217209 wants to merge 4 commits into
ScaleWeather:mainfrom
Silas217209:add-f32-array-decoding

Conversation

@Silas217209
Copy link
Copy Markdown

Adds support for decoding floating point arrays as Vec<f32> using codes_get_float_array. This is useful when the values are needed as Vec<f32> downstream since it avoids reading as Vec<f64> and converting manually afterward.

I added 2 benchmarks, which show that it is slightly faster, although the main improvement should be in downstream application code.

double array reading    time:   [1.5537 µs 1.5576 µs 1.5642 µs]  // preexisting

static double array reading
                        time:   [1.5308 µs 1.5359 µs 1.5436 µs]

static float array reading
                        time:   [1.4714 µs 1.4723 µs 1.4734 µs]

I tried to do everything as close to the existing implementations as possible. I am happy to adjust anything if you prefer a different API shape.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant