{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Working With Grid Surface Data","description":"Accelerate E&P application development and protect your innovation by consuming our Data and Domain APIs / Platform APIs.","lang":"en-US","meta":[{"name":"robots","content":"noindex"}],"llmstxt":{"hide":false}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"working-with-grid-surface-data","__idx":0},"children":["Working With Grid Surface Data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note"]},": You will need to include GridSurfaceData to your ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Module Dependencies"]}," list."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"loading-a-grid-from-a-file","__idx":1},"children":["Loading a grid from a file"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["We load an grid surface called filePath and print the access keys' name and range. If your application requires a file chooser for selecting the grid surface file, you can use the one provided with INTViewer. See section ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Using the Grid Surface File Chooser"]}," below for an example."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"    import com.interactive.intviewerapi.data.IData;\n    import com.interactive.intviewerapi.data.gridsurface.IGrid SurfaceData;\n    import com.interactive.intviewerapi.data.gridsurface.IGridSurfaceDataCollection;\n    ...\n    try {\n        IGridSurfaceDataCollection hd = IData.factory.createNewInstance(filePath, IGridSurfaceDataCollection.class);\n    } catch (Exception ex) {\n        DialogManager.getDefault().showMessageDialog(\"Error loading  grid: \" + filePath,\n         \"Error Loading Grid Surface\", DialogManager.ERROR);\n        return;\n    }\n      for (IGridSurfaceDataCollection shd: hd.getAllGridSurfaceData()){\n         List<IKeyRange> klist = shd.getDataRange();\n         for (IKeyRange kr:klist) {\n             System.out.println(kr);\n         }\n     }\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Internally, the default factory uses Netbeans FileObject and DataObject to load the grid surface. Netbeans filesystem supports the notion of a data pool, so that if you open several times the same file, you will get the same data object instance."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"using-the-grid-surface-file-chooser","__idx":2},"children":["Using the grid surface file chooser"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example shows how to let a user select a grid surface file using the built-in grid surface file selection dialog in INTViewer. The chooser is automatically setup to filter valid grid surface filenames. By default, the chooser enables multiple grid surface file selection."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To select one dataset:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"import com.interactive.intviewerapi.data.ISingleDataChooser;\n   // get the chooser for grid surface data type\n   ISingleDataChooser<IGridSurfaceDataCollection> singleChooser = ISingleDataChooser.Factory.createNewInstance(IDataChooser.GRID_SURFACE);\n   // popup the chooser dialog\n   int rc = singleChooser.setDataChooserVisible(true);\n   if (rc == JFileChooser.APPROVE_OPTION) {\n      IGridSurfaceDataCollection gridSurfaceData = singleChooser.getSelectedData();\n   }\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To select multiple datasets:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"   import com.interactive.intviewerapi.data.IMultipleDataChooser;\n   // get the file chooser for grid surface data type\n   IMultipleDataChooser<IGridSurfaceDataCollection> multipleChooser = IMultipleDataChooser.Factory.createNewInstance(IDataChooser.GRID_SURFACE);\n   // popup the chooser dialog\n   int rc = multipleChooser.setDataChooserVisible(true);\n   if (rc == JFileChooser.APPROVE_OPTION) {\n      for (IGridSurfaceDataCollection gridSurfaceData : multipleChooser.getSelectedData()) {\n      }\n   }\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getting-information-about-the-data-keys","__idx":3},"children":["Getting information about the data keys"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Range keys provide information about how to access the horizon data. They can be accessed as follows:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["List<IKeyRange>"]}," keyRangeList = gsd.getDataRange();"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Unlike in seismic datasets, the last key of a grid surface dataset is usually NOT the time key as it is a non-indexed attribute. The key names of a grid surface are X and Y. Time, Amplitude are usually non-indexed attributes."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"creating-a-new-grid-surface-from-scratch","__idx":4},"children":["Creating a new grid surface from scratch"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["We create a grid surface with:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["two attribute fields (Time and Amplitude)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["a origin (0,0)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["a x increment of 80"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["a y increment of 90"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["50 rows"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["40 columns"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["a rotation angle of 45 degrees"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"    import com.interactive.intviewerapi.data.gridsurface.GridSurfaceUtil;\n    import com.interactive.intviewerapi.data.FieldDesc;\n    ...\n    float[][] attributeValues = new float[2][50*40];\n    IGridSurfaceData gsd = GridSurfaceUtil.createGridSurfaceData(\"tmp\", \n        new FieldDesc[]{\n            new FieldDesc(\"Time\", 0),\n            new FieldDesc(\"Amplitude\", 1)\n        }, new Point2D.Double(0, 0), 80, 90, 50, 40, (float) Math.PI/4d, attributeValues);\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"querying-points","__idx":5},"children":["Querying points"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["We retrieve all the points for row 40 for the dataset created above."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"     IGridSurfaceData gsd = ...\n     for (int columnIndex = 0; columnIndex < gsd.getColumnCount(); columnIndex++) {\n         double currentTime = gsd.getValueAt(40, columnIndex, 0);\n         double currentAmplitude = gsd.getValueAt(40, columnIndex, 1);\n     }\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Grid surface datasets are read-only. You cannot add, update or delete points."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"saving-a-grid-surface","__idx":6},"children":["Saving a grid surface"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You could do the following to save a grid surface:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"    ISingleDataSaver ds = ISingleDataSaver.Factory.createNewInstance(IDataChooser.GRID_SURFACE);\n    if (ds.setDataSaverVisible(true, gridSurfaceData.getDataPath(), gridSurfaceData) == JFileChooser.APPROVE_OPTION) {\n        GridSurfaceDataCollection savingGridSurfaces = GridSurfaceUtil.createGridSurfaceDataCollection(\"temp\");\n        savingGridSurfaces.addGridSurfaceData(gridSurfaceData);\n        FileObject fo = (FileObject) ds.saveDataAndWait(savingGridSurfaces);\n        if (fo != null) {\n            String absoluteDataPath = FileUtil.toFile(fo).getAbsolutePath();\n            if (gridSurfaceData.getDataPath() == null || gridSurfaceData.getDataPath().length() == 0) {\n                gridSurfaceData.setDataPath(absoluteDataPath);\n            }\n        }\n    }\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This would display a dialog to let the users select the fileName in which they want to save the IGridSurfaceData."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Note: in your project module properties, you will need to include File System API to your ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Module Dependencies"]}," list."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"grid-surface-data-and-grid-surface-data-collection","__idx":7},"children":["Grid Surface Data and Grid Surface Data Collection"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example shows how to extract a single IGridSurfaceData object out of an IData object that could be IGridSurfaceData or IGridSurfaceDataCollection."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"if (data instanceof IGridSurfaceData) {\n   return ( IGridSurfaceData ) data;\n} else if (data instanceof IGridSurfaceDataCollection) {\n   IGridSurfaceData currentData = null;\n   if (data.getDataName() != null) {\n      currentData = ((IGridSurfaceDataCollection) data).getGridSurfaceData(data.getDataName());\n   }\n   if (currentData == null) {\n      currentData = ((IGridSurfaceDataCollection) data).getAllGridSurfaceData()[0];\n   }\n   return (IGridSurfaceData) currentData;\n} else {\n   return null;\n}\n"},"children":[]}]},"headings":[{"value":"Working With Grid Surface Data","id":"working-with-grid-surface-data","depth":1},{"value":"Loading a grid from a file","id":"loading-a-grid-from-a-file","depth":3},{"value":"Using the grid surface file chooser","id":"using-the-grid-surface-file-chooser","depth":3},{"value":"Getting information about the data keys","id":"getting-information-about-the-data-keys","depth":3},{"value":"Creating a new grid surface from scratch","id":"creating-a-new-grid-surface-from-scratch","depth":3},{"value":"Querying points","id":"querying-points","depth":3},{"value":"Saving a grid surface","id":"saving-a-grid-surface","depth":3},{"value":"Grid Surface Data and Grid Surface Data Collection","id":"grid-surface-data-and-grid-surface-data-collection","depth":3}],"frontmatter":{"title":"Working With Grid Surface Data","pageId":"intviewer-apis-for-data/working-with-grid-surface-data","seo":{"title":"Working With Grid Surface Data"}},"lastModified":"2026-10-22T14:32:05.574Z","pagePropGetterError":{"message":"","name":""}},"slug":"/solutions/intviewer/intviewer-apis-for-data/working-with-grid-surface-data","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}