Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul mechanism for passing data by duplication or reference #3532

Merged
merged 8 commits into from
Jun 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified doc/examples/ex34/ex34.ps
Binary file not shown.
12 changes: 6 additions & 6 deletions doc/rst/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ different data types.
Here, ``mode`` determines how we read the grid: To read the entire
grid and its header, pass ``GMT_CONTAINER_AND_DATA``. However, if you may need to
extract a sub-region you must first read the header by passing
``GMT_CONTAINER_ONLY``, then examine the header structure range
``GMT_CONTAINER_ONLY`` with ``wesn`` = NULL, then examine the header structure range
attributes, specify a subset via the array ``wesn``, and
finally call GMT_Read_Data_ a second time, now with ``mode`` =
``GMT_DATA_ONLY``, passing your ``wesn`` array and the grid
Expand Down Expand Up @@ -1684,11 +1684,11 @@ to ``family`` so that the module knows what to do. Finally, in the case of pass
``data`` as NULL you may also control what type of matrix or vector will be created in
GMT for the output by adding in the modifiers GMT_VIA_type, as listed in :ref:`types <tbl-viatypes>`.
**Note**: GMT tries to minimize data duplication if possible, so if your input arrays are
compatible with the data type used by the modules then we may use your array directly.
This *may* have the side-effect that your input array is modified by the module.
If you want to prevent this from happening then add GMT_IS_DUPLICATE to the ``direction``
argument and we will duplicate the array internally to make sure your input is truly
read-only.
compatible with the data type used by the modules then we could use your array directly.
This *may* have the side-effect that your input array is modified by the module, especially
if the module writes the results to a netCDF grid file.
If that is a price you are willing to pay then you can add GMT_IS_REFERENCE to the ``direction``
argument and we will pass the array internally to avoid duplicating memory.

Import from a virtual file
~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
146 changes: 87 additions & 59 deletions src/gmt_api.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/gmt_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ GMT_LOCAL int gmtinit_rectR_to_geoR (struct GMT_CTRL *GMT, char unit, double rec
/* Set up machinery to call mapproject */

/* Register In as input virtual file and define an output virtual file */
if (GMT_Open_VirtualFile (GMT->parent, GMT_IS_DATASET, GMT_IS_POINT, GMT_IN, In, in_string) == GMT_NOTSET)
if (GMT_Open_VirtualFile (GMT->parent, GMT_IS_DATASET, GMT_IS_POINT, GMT_IN|GMT_IS_REFERENCE, In, in_string) == GMT_NOTSET)
return (GMT->parent->error);
if (GMT_Open_VirtualFile (GMT->parent, GMT_IS_DATASET, GMT_IS_POINT, GMT_OUT, NULL, out_string) == GMT_NOTSET)
return (GMT->parent->error);
Expand Down
2 changes: 1 addition & 1 deletion src/gmt_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2835,7 +2835,7 @@ GMT_LOCAL int gmtio_prep_ogr_output (struct GMT_CTRL *GMT, struct GMT_DATASET *D

/* Determine w/e/s/n via GMT_gmtinfo */

if (GMT_Open_VirtualFile (GMT->parent, GMT_IS_DATASET, GMT_IS_POINT, GMT_IN, D, in_string) == GMT_NOTSET) {
if (GMT_Open_VirtualFile (GMT->parent, GMT_IS_DATASET, GMT_IS_POINT, GMT_IN|GMT_IS_REFERENCE, D, in_string) == GMT_NOTSET) {
return (GMT->parent->error);
}
if (GMT_Open_VirtualFile (GMT->parent, GMT_IS_DATASET, GMT_IS_POINT, GMT_OUT, NULL, out_string) == GMT_NOTSET) {
Expand Down
2 changes: 1 addition & 1 deletion src/gmtlogo.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ EXTERN_MSC int GMT_gmtlogo (void *V_API, int mode, void *args) {
if ((M = GMT_Create_Data (API, GMT_IS_DATASET|GMT_VIA_MATRIX, GMT_IS_POLY, GMT_CONTAINER_ONLY, par, NULL, NULL, 0, GMT_IS_ROW_FORMAT, NULL)) == NULL)
exit (EXIT_FAILURE);
GMT_Put_Matrix (API, M, GMT_FLOAT, 0, gmt_letters); /* Hook in our static float matrix */
GMT_Open_VirtualFile (API, GMT_IS_DATASET|GMT_VIA_MATRIX, GMT_IS_POLY, GMT_IN, M, file); /* Open matrix for reading */
GMT_Open_VirtualFile (API, GMT_IS_DATASET|GMT_VIA_MATRIX, GMT_IS_POLY, GMT_IN|GMT_IS_REFERENCE, M, file); /* Open matrix for reading */
sprintf (cmd, "-<%s -R167/527/-90/90 -JI-13/%gi -O -K -G%s@40 --GMT_HISTORY=false",
file, scale * 1.55, c_gmt_shadow);
GMT_Report (API, GMT_MSG_INFORMATION, "Calling psxy with args %s\n", cmd);
Expand Down
4 changes: 2 additions & 2 deletions src/grd2kml.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ EXTERN_MSC int GMT_grd2kml (void *V_API, int mode, void *args) {
gmt_M_str_free (S->text[c]); /* Free previous string */
S->text[c] = strdup (line); /* Update string */
}
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_NONE, GMT_IN, C, contour_file) != GMT_NOERROR) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_NONE, GMT_IN|GMT_IS_REFERENCE, C, contour_file) != GMT_NOERROR) {
GMT_Report (API, GMT_MSG_ERROR, "Unable to create virtual file for contours\n");
gmt_M_free (GMT, Q);
GMT_Destroy_Data (API, &C);
Expand Down Expand Up @@ -848,7 +848,7 @@ EXTERN_MSC int GMT_grd2kml (void *V_API, int mode, void *args) {
if (use_tile) { /* Found data inside this tile, make plot and rasterize (if PostScript) */
char z_data[GMT_VF_LEN] = {""}, psfile[PATH_MAX] = {""};
/* Open the grid subset as a virtual file we can pass to grdimage */
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN, T, z_data) == GMT_NOTSET) {
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN|GMT_IS_REFERENCE, T, z_data) == GMT_NOTSET) {
GMT_Report (API, GMT_MSG_ERROR, "Unable to open grid tile as virtual file!\n");
gmt_M_free (GMT, Q);
if (Ctrl->W.active) GMT_Destroy_Data (API, &C);
Expand Down
2 changes: 1 addition & 1 deletion src/grdfill.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ GMT_LOCAL int grdfill_do_splinefill (struct GMTAPI_CTRL *API, struct GMT_GRID *G
GMT_Put_Vector (API, V, GMT_Y, GMT_DOUBLE, y);
GMT_Put_Vector (API, V, GMT_Z, GMT_FLOAT, z);
/* Associate our input data vectors with a virtual input file */
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET|GMT_VIA_VECTOR, GMT_IS_POINT, GMT_IN, V, input) == GMT_NOTSET)
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET|GMT_VIA_VECTOR, GMT_IS_POINT, GMT_IN|GMT_IS_REFERENCE, V, input) == GMT_NOTSET)
return (API->error);
/* Prepare the greenspline command-line arguments */
mode = (gmt_M_is_geographic (GMT, GMT_IN)) ? 2 : 1;
Expand Down
2 changes: 1 addition & 1 deletion src/grdfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1339,7 +1339,7 @@ EXTERN_MSC int GMT_grdfilter (void *V_API, int mode, void *args) {

/* Here we low-passed filtered onto a coarse grid but to get high-pass we must sample the low-pass result at the original resolution */
/* Create a virtual file for the low-pass filtered grid */
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN, Gout, in_string) == GMT_NOTSET) {
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN|GMT_IS_REFERENCE, Gout, in_string) == GMT_NOTSET) {
Return (API->error);
}
/* Create a virtual file to hold the resampled grid */
Expand Down
2 changes: 1 addition & 1 deletion src/grdfilter_mt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ int GMT_grdfilter_mt (void *V_API, int mode, void *args)
char in_string[GMT_VF_LEN], out_string[GMT_VF_LEN], cmd[GMT_LEN256];
/* Here we low-passed filtered onto a coarse grid but to get high-pass we must sample the low-pass result at the original resolution */
/* Create a virtual file for the low-pass filtered grid */
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN, Gout, in_string) == GMT_NOTSET) {
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN|GMT_IS_REFERENCE, Gout, in_string) == GMT_NOTSET) {
Return (API->error);
}
/* Create a virtual file to hold the resampled grid */
Expand Down
4 changes: 2 additions & 2 deletions src/grdimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ EXTERN_MSC int GMT_grdimage (void *V_API, int mode, void *args) {
//if ((Grid_orig[0] = GMT_Read_Data (API, GMT_IS_GRID, GMT_IS_FILE, GMT_IS_SURFACE, GMT_CONTAINER_AND_DATA, GMT->common.R.wesn, Ctrl->In.file[0], NULL)) == NULL) /* Get srtm grid data */
if ((Grid_orig[0] = GMT_Read_Data (API, GMT_IS_GRID, GMT_IS_FILE, GMT_IS_SURFACE, GMT_CONTAINER_AND_DATA, API->tile_wesn, Ctrl->In.file[0], NULL)) == NULL) /* Get srtm grid data */
Return (API->error);
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN, Grid_orig[0], data_grd))
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN|GMT_IS_REFERENCE, Grid_orig[0], data_grd))
Return (API->error);
got_data_grid = true;
}
Expand Down Expand Up @@ -917,7 +917,7 @@ EXTERN_MSC int GMT_grdimage (void *V_API, int mode, void *args) {

char in_string[GMT_VF_LEN] = {""}, out_string[GMT_VF_LEN] = {""};
/* Associate the intensity grid with an open virtual file - in_string will then hold the name of this input "file" */
GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN, Intens_orig, in_string);
GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN|GMT_IS_REFERENCE, Intens_orig, in_string);
/* Create a virtual file to hold the resampled grid - out_string then holds the name of this output "file" */
GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_OUT, NULL, out_string);
/* Create the command to do the resampling via the grdsample module */
Expand Down
4 changes: 2 additions & 2 deletions src/grdinterpolate.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ EXTERN_MSC int GMT_grdinterpolate (void *V_API, int mode, void *args) {
GMT_Report (API, GMT_MSG_ERROR, "Unable to create output dataset for time-series\n");
Return (API->error);
}
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_POINT, GMT_IN, In, i_file) != GMT_NOERROR) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_POINT, GMT_IN|GMT_IS_REFERENCE, In, i_file) != GMT_NOERROR) {
GMT_Report (API, GMT_MSG_ERROR, "Unable to create virtual dataset for time-series\n");
Return (API->error);
}
Expand Down Expand Up @@ -597,7 +597,7 @@ EXTERN_MSC int GMT_grdinterpolate (void *V_API, int mode, void *args) {
gmt_set_column (GMT, GMT_OUT, col, level_type); /* This is the grid-level data type which on output is in this column */

if (Ctrl->T.active) { /* Want to interpolate through the sampled points using the specified spline */
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_LINE, GMT_IN, Out, i_file) != GMT_NOERROR) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_LINE, GMT_IN|GMT_IS_REFERENCE, Out, i_file) != GMT_NOERROR) {
GMT_Report (API, GMT_MSG_ERROR, "Unable to create virtual dataset for sampled time-series\n");
Return (API->error);
}
Expand Down
2 changes: 1 addition & 1 deletion src/grdview.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ EXTERN_MSC int GMT_grdview (void *V_API, int mode, void *args) {
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_OUT, NULL, int_grd))
Return (API->error);
if (Topo->data) { /* If not NULL it means we have a tiled and blended grid, use as is */
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN, Topo, data_file))
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN|GMT_IS_REFERENCE, Topo, data_file))
Return (API->error);
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/img/img2grd.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ EXTERN_MSC int GMT_img2grd (void *V_API, int mode, void *args) {
/* Preparing source and destination for GMT_grdproject */
/* a. Register the Mercator grid to be the source read by GMT_grdproject by passing a pointer */
GMT_Report (API, GMT_MSG_DEBUG, "Open Mercator Grid as grdproject virtual input\n");
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN, Merc, input) != GMT_NOERROR) {
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN|GMT_IS_REFERENCE, Merc, input) != GMT_NOERROR) {
Return (API->error);
}
/* b. If -E: Register a grid struct Geo to be the destination allocated and written to by GMT_grdproject, else write to -G<file> */
Expand Down Expand Up @@ -815,7 +815,7 @@ EXTERN_MSC int GMT_img2grd (void *V_API, int mode, void *args) {
sprintf (Geo->header->x_units, "longitude [degrees_east]");
sprintf (Geo->header->y_units, "latitude [degrees_north]");
GMT_Report (API, GMT_MSG_DEBUG, "Open Geo Grid container as grdsample virtual input\n");
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN, Geo, input) != GMT_NOERROR) {
if (GMT_Open_VirtualFile (API, GMT_IS_GRID, GMT_IS_SURFACE, GMT_IN|GMT_IS_REFERENCE, Geo, input) != GMT_NOERROR) {
Return (API->error);
}
sprintf (cmd, "-R%g/%g/%g/%g -I%gm %s -G%s -fg --GMT_HISTORY=false", west, east, south, north, Ctrl->I.value, input, Ctrl->G.file);
Expand Down
10 changes: 5 additions & 5 deletions src/pslegend.c
Original file line number Diff line number Diff line change
Expand Up @@ -1730,7 +1730,7 @@ EXTERN_MSC int GMT_pslegend (void *V_API, int mode, void *args) {
if (D[FRONT]) {
/* Create option list, register D[FRONT] as input source */
D[FRONT]->table[0]->n_segments = n_fronts; /* Set correct number of fronts */
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_LINE, GMT_IN, D[FRONT], string) != GMT_NOERROR) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_LINE, GMT_IN|GMT_IS_REFERENCE, D[FRONT], string) != GMT_NOERROR) {
Return (API->error);
}
sprintf (buffer, "-R0/%g/0/%g -Jx1i -O -K -N -Sf0.1i %s --GMT_HISTORY=false", GMT->current.proj.rect[XHI], GMT->current.proj.rect[YHI], string);
Expand All @@ -1753,7 +1753,7 @@ EXTERN_MSC int GMT_pslegend (void *V_API, int mode, void *args) {
if (D[QLINE]) {
/* Create option list, register D[QLINE] as input source */
D[QLINE]->table[0]->n_segments = n_quoted_lines; /* Set correct number of lines */
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_LINE, GMT_IN, D[QLINE], string) != GMT_NOERROR) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_LINE, GMT_IN|GMT_IS_REFERENCE, D[QLINE], string) != GMT_NOERROR) {
Return (API->error);
}
sprintf (buffer, "-R0/%g/0/%g -Jx1i -O -K -N -Sqn1 %s --GMT_HISTORY=false", GMT->current.proj.rect[XHI], GMT->current.proj.rect[YHI], string);
Expand All @@ -1776,7 +1776,7 @@ EXTERN_MSC int GMT_pslegend (void *V_API, int mode, void *args) {
if (D[SYM]) {
D[SYM]->table[0]->n_segments = n_symbols; /* Set correct number of segments */
/* Create option list, register D[SYM] as input source */
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_POINT, GMT_IN, D[SYM], string) != GMT_NOERROR) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_POINT, GMT_IN|GMT_IS_REFERENCE, D[SYM], string) != GMT_NOERROR) {
Return (API->error);
}
/* Because the sizes internally are in inches we must tell plot that inch is the current length unit */
Expand All @@ -1800,7 +1800,7 @@ EXTERN_MSC int GMT_pslegend (void *V_API, int mode, void *args) {
if (D[TXT]) {
D[TXT]->table[0]->segment[0]->n_rows = D[TXT]->n_records = krow[TXT];
/* Create option list, register D[TXT] as input source */
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_NONE, GMT_IN, D[TXT], string) != GMT_NOERROR) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_NONE, GMT_IN|GMT_IS_REFERENCE, D[TXT], string) != GMT_NOERROR) {
Return (API->error);
}
sprintf (buffer, "-R0/%g/0/%g -Jx1i -O -K -N -F+f+j %s --GMT_HISTORY=false", GMT->current.proj.rect[XHI], GMT->current.proj.rect[YHI], string);
Expand Down Expand Up @@ -1829,7 +1829,7 @@ EXTERN_MSC int GMT_pslegend (void *V_API, int mode, void *args) {
}

/* Create option list, register D[PAR] as input source */
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_TEXT, GMT_IN, D[PAR], string) != GMT_NOERROR) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_TEXT, GMT_IN|GMT_IS_REFERENCE, D[PAR], string) != GMT_NOERROR) {
Return (API->error);
}
sprintf (buffer, "-R0/%g/0/%g -Jx1i -O -K -N -M -F+a+f+j %s --GMT_HISTORY=false", GMT->current.proj.rect[XHI], GMT->current.proj.rect[YHI], string);
Expand Down
2 changes: 1 addition & 1 deletion src/psternary.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ EXTERN_MSC int GMT_psternary (void *V_API, int mode, void *args) {
}
if (Ctrl->S.active) { /* Plot symbols */
char vfile[GMT_VF_LEN] = {""};
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_POINT, GMT_IN, D, vfile) == GMT_NOTSET) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_POINT, GMT_IN|GMT_IS_REFERENCE, D, vfile) == GMT_NOTSET) {
GMT_Report (API, GMT_MSG_ERROR, "Unable to create a virtual data set\n");
Return (API->error);
}
Expand Down
2 changes: 1 addition & 1 deletion src/psxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ GMT_LOCAL int psxy_plot_decorations (struct GMT_CTRL *GMT, struct GMT_DATASET *D
return GMT_NOERROR;

/* Here we have symbols. Open up virtual file for the call to psxy */
if (GMT_Open_VirtualFile (GMT->parent, GMT_IS_DATASET, GMT_IS_POINT, GMT_IN, D, string) != GMT_NOERROR)
if (GMT_Open_VirtualFile (GMT->parent, GMT_IS_DATASET, GMT_IS_POINT, GMT_IN|GMT_IS_REFERENCE, D, string) != GMT_NOERROR)
return (GMT->parent->error);
if (decorate_custom) { /* Must find the custom symbol */
if ((type = gmt_locate_custom_symbol (GMT, &symbol_code[1], name, path, &pos)) == 0) return (GMT_RUNTIME_ERROR);
Expand Down
6 changes: 3 additions & 3 deletions src/subplot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ EXTERN_MSC int GMT_subplot (void *V_API, int mode, void *args) {
T->table[0]->segment[0]->text[0] = strdup (Ctrl->T.title);
T->table[0]->segment[0]->n_rows = 1;
T->n_records = T->table[0]->n_records = T->table[0]->segment[0]->n_rows = 1;
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_NONE, GMT_IN, T, vfile) != GMT_NOERROR) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_NONE, GMT_IN|GMT_IS_REFERENCE, T, vfile) != GMT_NOERROR) {
Return (API->error);
}
sprintf (command, "-R0/%g/0/%g -Jx1i -N -F+jBC+f%s %s -X%c%gi -Y%c%gi --GMT_HISTORY=false",
Expand Down Expand Up @@ -1232,7 +1232,7 @@ EXTERN_MSC int GMT_subplot (void *V_API, int mode, void *args) {
Return (API->error);
}
if (Ctrl->F.Lpen[0]) { /* Draw lines between interior tiles */
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_LINE, GMT_IN, L, vfile) != GMT_NOERROR) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_LINE, GMT_IN|GMT_IS_REFERENCE, L, vfile) != GMT_NOERROR) {
Return (API->error);
}
sprintf (command, "-R0/%g/0/%g -Jx1i -W%s %s --GMT_HISTORY=false", Ctrl->F.dim[GMT_X] + GMT->current.setting.map_origin[GMT_X], Ctrl->F.dim[GMT_Y] + GMT->current.setting.map_origin[GMT_Y], Ctrl->F.Lpen, vfile);
Expand Down Expand Up @@ -1357,7 +1357,7 @@ EXTERN_MSC int GMT_subplot (void *V_API, int mode, void *args) {
if ((D = GMT_Read_Data (API, GMT_IS_DATASET, GMT_IS_FILE, GMT_IS_POLY, 0, NULL, file, NULL)) == NULL) {
Return (API->error);
}
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_POLY, GMT_IN, D, vfile) != GMT_NOERROR) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET, GMT_IS_POLY, GMT_IN|GMT_IS_REFERENCE, D, vfile) != GMT_NOERROR) {
Return (API->error);
}
sprintf (command, "-R%s -Jx1i %s -L -Wfaint,red -Xa0i -Ya0i --GMT_HISTORY=false", D->table[0]->header[0], vfile);
Expand Down
2 changes: 1 addition & 1 deletion src/surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ EXTERN_MSC int GMT_surface (void *V_API, int mode, void *args) {
GMT_Put_Vector (API, V, GMT_X, GMT_DOUBLE, data[GMT_X]);
GMT_Put_Vector (API, V, GMT_Y, GMT_DOUBLE, data[GMT_Y]);
/* Create a virtual file for reading the input data grid */
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET|GMT_VIA_VECTOR, GMT_IS_POINT, GMT_IN, V, input) == GMT_NOTSET) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET|GMT_VIA_VECTOR, GMT_IS_POINT, GMT_IN|GMT_IS_REFERENCE, V, input) == GMT_NOTSET) {
Return (API->error);
}
/* Create a virtual file to hold the mask grid */
Expand Down
2 changes: 1 addition & 1 deletion src/surface_experimental.c
Original file line number Diff line number Diff line change
Expand Up @@ -2450,7 +2450,7 @@ int GMT_surface_mt (void *V_API, int mode, void *args) {
GMT_Put_Vector (API, V, GMT_X, GMT_DOUBLE, data[GMT_X]);
GMT_Put_Vector (API, V, GMT_Y, GMT_DOUBLE, data[GMT_Y]);
/* Create a virtual file for reading the input data grid */
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET|GMT_VIA_VECTOR, GMT_IS_POINT, GMT_IN, V, input) == GMT_NOTSET) {
if (GMT_Open_VirtualFile (API, GMT_IS_DATASET|GMT_VIA_VECTOR, GMT_IS_POINT, GMT_IN|GMT_IS_REFERENCE, V, input) == GMT_NOTSET) {
Return (API->error);
}
/* Create a virtual file to hold the mask grid */
Expand Down
Loading