Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conservative interpolation using grid-box-average #33

@Zappandy

Description

@Zappandy

What happened?

I'm trying to interpolate healpix512 data conservatively using the MARS language, which uses MIR in the backend to interpolate.

However, our mars-client doesn't seem to recognize some of the interpolation strategies mentioned in the documentation.

I'm wondering if there's a way to directly do conservative interpolation if we clone the repository and use the MIR binary. In the past, we've done interpolations using the MIR_BINARY we have available like this:

$MIR_BINARY --grid=0.25/0.25 --intgrid=F90 --truncation=179 --area=90/0/-90/360 "$INPUT_FILE" "$OUTPUT_FILE"

What would the command look like when we want to perform conservative interpolations using an H512 input grib file instead?

As a side note, is there a way to change the MIR binary a given mars-client uses?

What are the steps to reproduce the bug?

This error occurs with a local mars client on MN5. The mars request we use to retrieve the data from the FDB looks like this:

retrieve,
    class=d1,
    dataset=climate-dt,
    activity=HighResMIP,
    experiment=cont,
    date=19920101/to/19920103,
    generation=1,
    realization=1,
    model=IFS-NEMO,
    expver=a1yv,
    stream=clte,
    levelist=5/10,
    levtype=pl,
    param=129,
    resolution=high,
    target=input_n320.grib,
    grid=N320,
    time=0000/to/2300/by/0800,
    type=fc,
    interpolation=grid_box_average

The interpolation method will fail if it is not linear, which makes me think our MIR version may be out of date or incomplete. At least the one our MARS client is using. We run it on the supercomputer MareNostrum5 with this bash script:

#!/bin/bash

module purge
module load intel/2024.2 mkl/2024.2

MARS_CLIENT=/gpfs/projects/ehpc01/dte/mars/versions/7.0.2.8/bin/mars-client
export FDB_HOME=/gpfs/scratch/ehpc01/experiments/a1yv/fdb
N320_request=./n320_mars_request.mars
$MARS_CLIENT $N320_request

Please note that the ordering of the retrieved H512 data is nested, which MIR seems to modify to ring.

Version

1.23.1

Platform (OS and architecture)

Red Hat Enterprise Linux 9.2 (Plow)

Relevant log output

mars - EROR - 2025-06-12 19:30:59 Exception: UserError: TypeEnum[name=interpolation]: cannot expand 'grid_box_average' Request starting line 1 
mars - EROR - 2025-06-12 19:30:59 Exception: UserError: UserError: TypeEnum[name=interpolation]: cannot expand 'grid_box_average' Request starting line 1 request=retrieve,class=d1,dataset=climate-dt,activity=HighResMIP,experiment=cont,date=19920101/to/19920103,generation=1,realization=1,model=IFS-NEMO,expver=a1yv,stream=clte,levelist=5/10,levtype=pl,param=129,resolution=high,target=input_n320.grib,grid=N320,time=0000/to/2300/by/0800,type=fc,interpolation=grid_box_average, expanded=retrieve,class=d1,dataset=climate-dt,activity=highresmip,experiment=cont,date=19920101/19920102/19920103,generation=1,realization=1,model=ifs-nemo,expver=a1yv,stream=clte,levelist=5/10,levtype=pl,param=129,resolution=high,target=input_n320.grib,grid=N320,time=0000/0800/1600,type=fc 
mars - EROR - 2025-06-12 19:30:59 ** UserError: UserError: TypeEnum[name=interpolation]: cannot expand 'grid_box_average' Request starting line 1 request=retrieve,class=d1,dataset=climate-dt,activity=HighResMIP,experiment=cont,date=19920101/to/19920103,generation=1,realization=1,model=IFS-NEMO,expver=a1yv,stream=clte,levelist=5/10,levtype=pl,param=129,resolution=high,target=input_n320.grib,grid=N320,time=0000/to/2300/by/0800,type=fc,interpolation=grid_box_average, expanded=retrieve,class=d1,dataset=climate-dt,activity=highresmip,experiment=cont,date=19920101/19920102/19920103,generation=1,realization=1,model=ifs-nemo,expver=a1yv,stream=clte,levelist=5/10,levtype=pl,param=129,resolution=high,target=input_n320.grib,grid=N320,time=0000/0800/1600,type=fc Caught in  (/gpfs/projects/ehpc01/dte/MarsClient-7.0.2.8-Source/eckit/src/eckit/runtime/Tool.cc:31 start)
mars - EROR - 2025-06-12 19:30:59 ** Exception terminates mars-client

Accompanying data

No response

Organisation

Barcelona Supercomputing Center

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions