Coder Social home page Coder Social logo

Comments (13)

magnusuMET avatar magnusuMET commented on June 19, 2024 1

Implemented in #35

from netcdf.

lwandrebeck avatar lwandrebeck commented on June 19, 2024

Would something like this do (partially) the trick ?
lwandrebeck@4ce77a9

from netcdf.

magnusuMET avatar magnusuMET commented on June 19, 2024

Could you create an enum for endianess, which you convert to the corresponding value? It would also be nice to have both a setter and a getter for the endianess. The signature of the setter should be &mut self.

from netcdf.

lwandrebeck avatar lwandrebeck commented on June 19, 2024

What about lwandrebeck@e0afced ?

from netcdf.

magnusuMET avatar magnusuMET commented on June 19, 2024

Starting to look good now! Feel free to open a PR so I can comment directly on it, and let travis have a go at it.

endian_value should return error::Result<Endianness> and enum Endianness should #[derive(Debug, Copy, Clone)].

There should also be a test that uses these methods to ensures they are visible to the user. You don't have to test whether the underlying netcdf library actually sets this.

from netcdf.

magnusuMET avatar magnusuMET commented on June 19, 2024

Endianness could also derive PartialEq, but then the equality native <-> little/big has to be decided.

from netcdf.

lwandrebeck avatar lwandrebeck commented on June 19, 2024

Ok, I’m on test part. It looks like netcdf does not use Native, but converts silently to Little or Big depending on the arch the file is created on. I need to dig a bit deeper about that.

from netcdf.

magnusuMET avatar magnusuMET commented on June 19, 2024

Maybe one can put Native, but you will never get Native in return?

from netcdf.

lwandrebeck avatar lwandrebeck commented on June 19, 2024

It seems even if you give Big on create, it is written as Little on a little-endian arch.
« and the library takes care of the conversions on reading or writing, so that programs using the library alsways deal with the data in native form. That's one of the purposes of the netCDF library, to insulate programmers from having to know anything about characterisitics of the computer on which the data was written. » from https://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg11257.html

from netcdf.

lwandrebeck avatar lwandrebeck commented on June 19, 2024

I left test out of #35 as we need to dive a bit more into netcdf lib and decide what and how to test endianness.

from netcdf.

magnusuMET avatar magnusuMET commented on June 19, 2024

Might be that the endianess is not set before it is synced. You could try putting a value then reading it back out. The only purpose of setting the endianess ourself would be to avoid endianess conversion on the target, otherwise it should be hidden.

from netcdf.

magnusuMET avatar magnusuMET commented on June 19, 2024

We could test the true endianess once #33 is implemented.

from netcdf.

lwandrebeck avatar lwandrebeck commented on June 19, 2024

Ok, I’ve fixed up a stupid bug introduced by myself in test.
Native is automatically converted by netcdf into either Little or Big. Adding test to PR.

from netcdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.