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

block* and -G from externals must always return grids #2795

Closed
joa-quim opened this issue Feb 24, 2020 · 2 comments
Closed

block* and -G from externals must always return grids #2795

joa-quim opened this issue Feb 24, 2020 · 2 comments

Comments

@joa-quim
Copy link
Member

When calling from externals with -G we are expecting to always get grids, but if, for example, condition
"No data records found; no output produced is triggered we return error and no grids. This in itself will trigger calls to the external error() function, which is ... not good. What should happen is the return of empty grids (that is, all NaNs)

@PaulWessel
Copy link
Member

Yes, need elegant solution for this. E.g.,

if (n_read == 0) {	/* Blank/empty input files */
	GMT_Report (API, GMT_MSG_WARNING, "No data records found; no output produced\n");
	GMT_External_Cleanup (API, GMT_IS_GRID, file);  /* Possibly other args but -R should be set already */
	Return (GMT_NOERROR);
}

where GMT_External_Cleanup is in charge of creating an empty grid or a no-record data set etc and call GMT_Write_Data on that if API->external is true. in blockmean there may be several grids requested so there may need to be a loop there (module specific). Perhaps think about where else we may run into this and take note of how GMT_External_Cleanup needs to work.

@PaulWessel
Copy link
Member

Fixed. closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants