title: where选项

weight: 3

where选项 -w 用于打印符合约束条件的消息。 约束条件有如下的格式:

IS

  1. key=value

下面命令打印层次值等于100的要素场。

  1. $ grib_ls -w level=100 gmf.gra.2020011800003.grb2
  2. gmf.gra.2020011800003.grb2
  3. edition centre date dataType gridType typeOfLevel level stepRange shortName packingType
  4. 2 babj 20200118 fc regular_ll isobaricInhPa 100 3 gh grid_jpeg
  5. ...
  6. 2 babj 20200118 fc regular_ll isobaricInhPa 100 3 unknown grid_jpeg
  7. 24 of 837 messages in gmf.gra.2020011800003.grb2
  8. 24 of 837 total messages in 1 files

IS NOT

  1. key!=value

下面命令打印层次类型不等于surface的要素场。

  1. $ grib_ls -w typeOfLevel!=surface gmf.gra.2020011800003.grb2
  2. gmf.gra.2020011800003.grb2
  3. edition centre date dataType gridType typeOfLevel level stepRange shortName packingType
  4. 2 babj 20200118 fc regular_ll nominalTop 0 3 ulwrf grid_jpeg
  5. 2 babj 20200118 fc regular_ll nominalTop 0 3 unknown grid_jpeg
  6. 2 babj 20200118 fc regular_ll nominalTop 0 0-3 nswrf grid_jpeg
  7. 2 babj 20200118 fc regular_ll nominalTop 0 3 uswrf grid_jpeg
  8. 2 babj 20200118 fc regular_ll nominalTop 0 3 nswrfcs grid_jpeg
  9. 2 babj 20200118 fc regular_ll nominalTop 0 3 uswrf_cs grid_jpeg
  10. 2 babj 20200118 fc regular_ll heightAboveGround 2 3 q grid_jpeg
  11. ...

AND

  1. key1=value1,key2=value2,key3=value3

下面代码打印层次值为100的温度场。

  1. $ grib_ls -w level=100,shortName=t gmf.gra.2020011800003.grb2
  2. gmf.gra.2020011800003.grb2
  3. edition centre date dataType gridType typeOfLevel level stepRange shortName packingType
  4. 2 babj 20200118 fc regular_ll isobaricInhPa 100 3 t grid_jpeg
  5. 1 of 837 messages in gmf.gra.2020011800003.grb2
  6. 1 of 837 total messages in 1 files

OR

  1. key=value1/value2/value3

下面代码打印层次值为100或200或300或500的温度场

  1. $ grib_ls -w level=100/200/300/500,shortName=t gmf.gra.2020011800003.grb2
  2. gmf.gra.2020011800003.grb2
  3. edition centre date dataType gridType typeOfLevel level stepRange shortName packingType
  4. 2 babj 20200118 fc regular_ll isobaricInhPa 500 3 t grid_jpeg
  5. 2 babj 20200118 fc regular_ll isobaricInhPa 300 3 t grid_jpeg
  6. 2 babj 20200118 fc regular_ll isobaricInhPa 200 3 t grid_jpeg
  7. 2 babj 20200118 fc regular_ll isobaricInhPa 100 3 t grid_jpeg
  8. 4 of 837 messages in gmf.gra.2020011800003.grb2
  9. 4 of 837 total messages in 1 files

使用 -w 参数意味着只有满足所有约束条件的消息才会被处理。