# Netcdf4 needs to be ported to Scilab \>= 6

**URL:** <https://scilab.discourse.group/t/netcdf4-needs-to-be-ported-to-scilab-6/30>\
**Category:** Atoms packages\
**Created:** [February 27, 2023, 3:51pm UTC](https://scilab.discourse.group/t/netcdf4-needs-to-be-ported-to-scilab-6/30 "2023-02-27T15:51:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [February 27, 2023, 3:51pm UTC](https://scilab.discourse.group/t/netcdf4-needs-to-be-ported-to-scilab-6/30/1 "2023-02-27T15:51:12Z")

</div>

The [netcdf](https://atoms.scilab.org/toolboxes/scinetcdf/1.2) package has not been ported to Scilab 6 family !

---

<div class="post-metadata">

**Author:** ![vincent.couvert](https://avatars.discourse-cdn.com/v4/letter/v/f4b2a3/32.png) [@vincent.couvert](https://scilab.discourse.group/u/vincent.couvert)\
**Post date:** [February 28, 2023, 3:21pm UTC](https://scilab.discourse.group/t/netcdf4-needs-to-be-ported-to-scilab-6/30/2 "2023-02-28T15:21:19Z")

</div>

I requested to be added as a maintainer for this package to be able to update it.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [February 28, 2023, 4:09pm UTC](https://scilab.discourse.group/t/netcdf4-needs-to-be-ported-to-scilab-6/30/3 "2023-02-28T16:09:52Z")

</div>

Thanks Vincent ! I managed to build the package under macOS with a conda environment but the netcdf thirdparty library had to be rebuilt. I still need to run all the tests.

---

<div class="post-metadata">

**Author:** ![arctica](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@arctica](https://scilab.discourse.group/u/arctica)\
**Post date:** [July 20, 2024, 9:44am UTC](https://scilab.discourse.group/t/netcdf4-needs-to-be-ported-to-scilab-6/30/4 "2024-07-20T09:44:42Z")

</div>

Regarding the netCDF package, it should really be utilizing the latest version (4.9.2) to access the modern structures.

The latest versions are always available at:  
[netCDF Downloads (ucar.edu)](https://downloads.unidata.ucar.edu/netcdf/)

Reading a netcdf file can be done via hdf5 in Scilab, but a proper implementation is required to write the files. HDF5 can get close to this but currently seems to lack the options for building compound and reference H5 objects (unless someone has figured this out?).

We definitely need a function for reading and writing netCDF4 files given the widespread use of the data format in science.

Lester

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [July 22, 2024, 7:27am UTC](https://scilab.discourse.group/t/netcdf4-needs-to-be-ported-to-scilab-6/30/5 "2024-07-22T07:27:15Z")

</div>

> [@arctica](#):
>
> We definitely need a function for reading and writing netCDF4 files given the widespread use of the data format in science.

Hello Lester,

You should ping the authors, as rebuilding this toolbox is not a trivial task. First, it has been created for netcdf 4.1.1 (likely) in 2016, which is now incompatible with Scilab’s version of hdf5 library. In order to work with current netcdf 4.9.2 all the swig interface has to be regenerated, and maybe also modified for the 4.9.2 netcdf API which has probably evolved since 4.1.1 version. This is not a small task and it needs skills (swig) that I do not have, sorry.

S.

---

<div class="post-metadata">

**Author:** ![arctica](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@arctica](https://scilab.discourse.group/u/arctica)\
**Post date:** [July 23, 2024, 7:16am UTC](https://scilab.discourse.group/t/netcdf4-needs-to-be-ported-to-scilab-6/30/6 "2024-07-23T07:16:02Z")

</div>

Hi Stephane,

I have popped a few queries to the maintainers (at present), and it would be good to get this one resolved. As you say, it is not a simple problem to solve!

I do not have the skills to work on the coding and compiling.

You can download and install netcdf 4.9.2 and add the /bin folder to the Windows path.

A quick test to display the contents of a netcdf file:

```auto
// netcdf functions
// assumes netcdf4 is installed in the system path

function [result, bOK]=dos_win(x)
    [result, bOK] = dos('exit |'+ x);
endfunction

function ncinfo = ncdisp(filename)
// Display structure of netcdf file    
    nc_path = strcat('ncdump -h '+filename)
    [ncinfo, bOK] = dos_win(nc_path)
endfunction

// ncgen to create netcdf file
// netcdf file compatible with HDF5 structure

```

Lester
