[Scilab-users] Getting netCDF files into Scilab 6.0.1

classic Classic list List threaded Threaded
4 messages Options
arctica1963 arctica1963
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] Getting netCDF files into Scilab 6.0.1

Hello,

I am looking to use netCDF files generated from the GMT software in Scilab
6.0.1, but there is no easy way to work the problem other than exporting the
data out from the binary grids to either XYZ or ESRI Ascii raster. The
latter is a more compact form with the basic structure of a header
describing the data limits and structure:

ncols 1200
nrows 1200
xllcorner -10 Lower-left X (Long-Lat limits -10/10/-10/10
yllcorner -10 Lower-Left Y
cellsize 0.0166666666667 - increment = 1 arc minute
nodata_value -9999
451.343170166 436.005554199 443.061035156 443.665924072 465.607574463
492.191741943 476.50994873 452.265014648 451.439880371 461.659393311 ......
...
... all of the Z-values
...

-4323.2890625 -4315.12451172 -4307.19384766 -4305.27490234 -4311.49902344
-4317.90771484 -4324.23046875 -4320.47070313 -4308.60107422 -4292.62011719
-4280.39697266

This is a moderately large file ~20 mB or so. Is there a way to reliably
read this structure and vectorise X, Y, and Z? The data I am looking at is a
grid so want to work on the whole grid as eith DEM data or gravity etc.

As a test, I converted the grid to xyz, and tried csvRead, having replaced
the spaces (which were not a constant number of spaces between values) with
commas. The file was in excess of 50 mb, so not that huge really, but
csvRead always failed to read all the file and drop out at one specific line
(~7608) with a message of inconsistent column numbers, i.e. it though there
were only 2 columns when in reality the whole thing was 3 (checked in the
program Surfer). When one looks at the line specified, it is clearly 3
columns.

Does csvRead have a limit to what it can load, if so what is a workaround? I
suppose one could chop it down into chunks and concatanate the arrays, but
that is a lot more work.

Any suggestions?

Thanks
Lester



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Ekin Akoglu-2 Ekin Akoglu-2
Reply | Threaded
Open this post in threaded view
|

Re: Getting netCDF files into Scilab 6.0.1

Why don't you use ATOMS package scinetcdf (https://atoms.scilab.org/toolboxes/scinetcdf/1.2)? It is precompiled for version 5.X, however, you just need to compile it in Scilab 6.0 to be able to use it. I am using it flawlessly in Scilab 6.0.1.

Best,

Ekin

--
Securely sent with Tutanota. Claim your encrypted mailbox today!
https://tutanota.com

22. Jul 2018 12:11 by [hidden email]:

Hello,

I am looking to use netCDF files generated from the GMT software in Scilab
6.0.1, but there is no easy way to work the problem other than exporting the
data out from the binary grids to either XYZ or ESRI Ascii raster. The
latter is a more compact form with the basic structure of a header
describing the data limits and structure:

ncols 1200
nrows 1200
xllcorner -10 Lower-left X (Long-Lat limits -10/10/-10/10
yllcorner -10 Lower-Left Y
cellsize 0.0166666666667 - increment = 1 arc minute
nodata_value -9999
451.343170166 436.005554199 443.061035156 443.665924072 465.607574463
492.191741943 476.50994873 452.265014648 451.439880371 461.659393311 ......
...
... all of the Z-values
...

-4323.2890625 -4315.12451172 -4307.19384766 -4305.27490234 -4311.49902344
-4317.90771484 -4324.23046875 -4320.47070313 -4308.60107422 -4292.62011719
-4280.39697266

This is a moderately large file ~20 mB or so. Is there a way to reliably
read this structure and vectorise X, Y, and Z? The data I am looking at is a
grid so want to work on the whole grid as eith DEM data or gravity etc.

As a test, I converted the grid to xyz, and tried csvRead, having replaced
the spaces (which were not a constant number of spaces between values) with
commas. The file was in excess of 50 mb, so not that huge really, but
csvRead always failed to read all the file and drop out at one specific line
(~7608) with a message of inconsistent column numbers, i.e. it though there
were only 2 columns when in reality the whole thing was 3 (checked in the
program Surfer). When one looks at the line specified, it is clearly 3
columns.

Does csvRead have a limit to what it can load, if so what is a workaround? I
suppose one could chop it down into chunks and concatanate the arrays, but
that is a lot more work.

Any suggestions?

Thanks
Lester



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
arctica1963 arctica1963
Reply | Threaded
Open this post in threaded view
|

Re: Getting netCDF files into Scilab 6.0.1

Hello Ekin,

The scinetcdf package is not available compiled for Windows v6.0.1 (yet). It
does work for 5.5.x to install. Reading and writing the ascii raster is a
workaround until it is avialable (and working) under 6.x.

Thanks for the info

Lester



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
arctica1963 arctica1963
Reply | Threaded
Open this post in threaded view
|

Re: Getting netCDF files into Scilab 6.0.1

As a general point, anyone know when the SciNetCdf package will be updated
for 6.0.1 ?

It fails to run/install on 6.0.1 because it references an older library (for
use in 5.5.2).



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users