Difference between revisions of "GridWetData FAQ"

From OCEBIS Wiki
Jump to: navigation, search
 
Line 10: Line 10:
  
 
<h2>Is there a tutorial for GridWetData?</h2>
 
<h2>Is there a tutorial for GridWetData?</h2>
... on the way
+
[[GridWetData_old_tut|GridWetData tutorial (updated soon)]]
 
 
  
 
<h2>Can I use GridWetData from R?</h2>
 
<h2>Can I use GridWetData from R?</h2>

Latest revision as of 21:38, 26 September 2018

What is GridWetData?

GridWetData is a framework written in Python enabling easy access and tools to manipulate gridded hydrographic data, like currents and tempature. GridWetData is a set of classes and functions that provides a uniform API to different data sets. GridWetData expand the number of data sets with interfaces as it is applied in projects. Initially it targets CMEMS data formats

Is GridWetData free?

GridWetData is free open software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation. A copy of GNU Lesser General Public License pertaining to GridWetData is provided in the file lgpl.txt, referring to the GNU General Public License provided in gpl.txt. GridWetData is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

How can I get GridWetData?

GridWetData is hosted on GitHub: https://github.com/asbjorn-christensen/GridWetData Here you can download a copy and assess the development of the code

Is there a tutorial for GridWetData?

GridWetData tutorial (updated soon)

Can I use GridWetData from R?

Yes. The reticulate package (see https://rstudio.github.io/reticulate/) allow you to run Python code from R. You can also draw in (access) objects from Python name spaces into R name spaces. Also GridWetData code using numpy and netcdf works; Suppose you have the following Python code (that in this example reads a netcdf temperature dataset, loads first frame into a GridData3D object, and finally interpolates the temperature in this frame at position (lon,lat,depth) = (3E, 55N, 2.3 meters)):

from GridWetData.CMEMS.NWS.NWS_grid_data import *
temp = NWS_GridData_3DwithTime("MetO-NWS-PHYS-hi-TEM.nc")
gd3d = temp.load_frame(0)
print gd3d((3, 55, 2.3))

The corresponding operation in R would be as follows:

library(reticulate)
pyNS = py_run_string("from GridWetData.CMEMS.NWS.NWS_grid_data import *")
temp = pyNS$NWS_GridData_3DwithTime("/home/data/CMEMS/NWS/MetO-NWS-PHYS-hi-TEM.nc")
gd3d = temp$load_frame(0)
gd3d(c(3, 55, 2.3))

Notice that you can reference objects across name spaces and simple types are converted to native R types. Since the reticulate package also offers py_run_script, if is possible to customize the python name space visible from R.