Skip to content

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

Closed

Description

@joa-quim

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)

Activity

  1. PaulWessel commented on Feb 24, 2020

    @PaulWessel
    Contributor

    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.

  2. PaulWessel commented on Mar 10, 2020

    @PaulWessel
    Contributor

    Fixed. closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions