bilinear_interp dimension size mismatch

  • Anonymous - 2012-07-05


    Im trying to make a bilinear interp for u and v but something fails.

    this is the input file header

    ncdpump -h

    longitude = 7;
    time = UNLIMITED; // (99 currently)

    float longitude (longitude);
    float latitude (latitude);
    int time(time);
    short u(time, latitude, longitude);
    short v(time, latitude, longitude);

    //global atributes
    Conventions = "CF-1.0"

    ncap2 -s "value=bilinear_interp(u, 0, 1, 2, latitude, longitude)"
    ERRO bilinear_interp(): Dimension size mismatch with input variables

    the input variables is longitude and latitude? its problem of time?

    thank you

  • Charlie Zender

    Charlie Zender - 2012-07-09

    Sorry for the late response.
    Yes, the error is caused because sizeof(latitude)*sizeof(longitude) does not equal sizeof(u).
    And that is because u has a time dimension as well.

  • Todd

    Todd - 2014-03-19


    So is there a simple way to spatially interpolate a file with X,Y, and time?
    I subsetted my original file so that it is for only one time step, although
    time is still carried in the file, and I get
    ERRO bilinear_interp(): Dimension size mismatch with input variables
    I am using ncap2 version 4.0.9

    If I break up my file into one file for each time step with no time information in it,
    I then need to figure out how to put the time value back into the interpolated files.

    Thank you

  • Todd

    Todd - 2014-03-19

    In thinking about it, the thing I want to really do is to perform X-Y interpolation of a 4-dimesional dataset. The North American Regional Reanalysis (NARR) is on a funny grid, and I want to bilinearly interpolate the data in the X-Y plane onto a regular grid for a region of interest.

  • Charlie Zender

    Charlie Zender - 2014-03-21

    I thought I answered this but apparently not. The short answer is that bilinear_interp() works on 2-D fields, so call it with 2-D hyperslabs
    from your 4-D array. I hope Henry will correct me if I'm wrong about that.


Log in to post a comment.