cambecc / earth

a project to visualize global weather conditions
http://earth.nullschool.net
MIT License
5.99k stars 1.17k forks source link

How to display the OSCAR 2.0 currents data? #139

Closed seraphzl closed 4 months ago

seraphzl commented 4 months ago

Hi,

I tried to display the OSCAR 2.0 currents data with the code from this repo.

I downloaded the currents data from https://podaac.jpl.nasa.gov/dataset/OSCAR_L4_OC_NRT_V2.0, convert it to json using the command grib2json -d -c -n -o 20240425-surface-currents-oscar-0.25.json oscar_currents_nrt_20240425.nc, and put it into the public/data/oscar directory. It turned out that no color, and strange currents display.

Screenshot from 2024-04-29 18-38-01

It was clearly that something was wrong. I read the news at https://nullschool.beehiiv.com/p/welcome-plus-an-update-on-ocean-currents, but did not know how to modify the code to support the column-major ordering of OSCAR 2.0 data.

Could you please give some hint or example about how to change the code to support OSCAR 2.0 currents data?

Thanks!

cambecc commented 4 months ago

Yes, this is the same table ordering problem I ran into. My suggestion would be to write a small program that rewrites the JSON file with the data array switched from row-major to column-major. That's easier than modifying the grib2json code.

seraphzl commented 4 months ago

@cambecc Thanks for your suggestion! I managed to convert the netcdf file to json with netcdf4 python package. It looks great.