Skip to content

Serialize all NumPy integer, float and bool scalars in json_serial - #2418

Open
Shubham-Padkonde wants to merge 1 commit into
geopython:masterfrom
Shubham-Padkonde:fix/json-serial-numpy-scalars
Open

Shubham-Padkonde wants to merge 1 commit into
geopython:masterfrom
Shubham-Padkonde:fix/json-serial-numpy-scalars

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor

json_serial only recognised int32, int64, float32 and float64 by type name, so other NumPy scalars that providers commonly return (e.g. uint8 or int16 nodata/fill values, float16 data, bool) raised "TypeError: ... not serializable". Match on NumPy's abstract integer and floating types (and bool) instead, still without importing NumPy.

Overview

Related Issue / discussion

Additional information

Dependency policy (RFC2)

  • I have ensured that this PR meets RFC2 requirements

Updates to public demo

Contributions and licensing

(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)

  • I'd like to contribute [feature X|bugfix Y|docs|something else] to pygeoapi. I confirm that my contributions to pygeoapi will be compatible with the pygeoapi license guidelines at the time of contribution
  • I have already previously agreed to the pygeoapi Contributions and Licensing Guidelines

json_serial only recognised int32, int64, float32 and float64 by type
name, so other NumPy scalars that providers commonly return (e.g. uint8
or int16 nodata/fill values, float16 data, bool) raised
"TypeError: ... not serializable". Match on NumPy's abstract integer
and floating types (and bool) instead, still without importing NumPy.

This branch has not been deployed

No deployments
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