Coder Social home page Coder Social logo

Comments (6)

vassilyl avatar vassilyl commented on June 2, 2024

Hi Auberginn, as far as I understand, the bits of each float32 were written to the file as two 16-bit words. You will need to read the variable as Int16, an then to manually convert each pair of ints to a float, i'm afraid. Class BitConverter may help you with this.

from sdslite.

Auberginn avatar Auberginn commented on June 2, 2024

Hi vassilyl, I'm not sure I understand the pairing Int16 that you mention. The table data in the image corresponds to a partial printscreen cut of the grid cells values shown by the DataSet Viewer Table. When I use the GetData in C#, it returns the same values, which -19725 corresponds to the first cell of the grid located at index [0,0,0] of the Int16 array (where the structure is [latitude, longitude, value]). The value should be in Kelvin and around 245°C.

from sdslite.

vassilyl avatar vassilyl commented on June 2, 2024

I may have misunderstood you.

... but the data is actually a float32

-- what does it actually mean? Can you show actual metadata on the variable (sds meta <ncfile> <var>)?

from sdslite.

Auberginn avatar Auberginn commented on June 2, 2024

My mistake, just float.
DataFlow Shell version 1.3.14517.0
DataSet Core version 1.3.14517.0

$dataset = Y2010M01.nc
Attached new DataSet at $dataset with id=1
show $dataset meta t2m
$dataset net.pipe://localhost/microsoft/research/science/data/StorageService/bebd021e-5c80-40cd-8f7f-d6c654d83492/
msds:nc?file=E:\era5land\Y2010M01.nc
[-6] t2m of type Int16 (time:744) (latitude:231) (longitude:441)
Name = t2m
_FillValue = -32767
units = K
long_name = 2 metre temperature
add_offset = 260.533688291066
scale_factor = 0.000845463766003984
missing_value = -32767

NetCDF GitHub sds 2

from sdslite.

SravaniBeeram avatar SravaniBeeram commented on June 2, 2024

I am having the same issue..@Auberginn can you please let me know if you were able to resolve this?

from sdslite.

vassilyl avatar vassilyl commented on June 2, 2024

SDSLite is transparent in regards to attribute conventions except for "missing_value".
In this particular case the library returns int16 values stored in the file, e.g. -19725. The scale_factor and add_offset metadata on the variable indicates how to convert the stored values to "physical" ones: -19725 * 0.000845463766003984 + 260.533688291066 = 243.8569155066374.
See Appendix A: Attribute Conventions at https://www.unidata.ucar.edu/software/netcdf/docs/attribute_conventions.html.

from sdslite.

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.