syntax = "proto3";

option java_package = "ucar.nc2.ft.point.bufr";
option java_outer_classname = "BufrCdmIndexProto";

message Station {
  string id = 1;
  double lat = 2;
  double lon = 3;
  double alt = 4;
  string desc = 5;
  string wmoId = 6;
  int32 count = 7;
}

enum FldAction {
  defa = 0;
  none = 1;
  remove = 2;
  asMissing = 3;
  asArray = 4;
  concat = 5;
}

enum FldType {
  def = 0;
  lat=1;
  lon=2;
  height=3;
  heightAboveStation=4;
  heightOfStation=5;
  stationId=10;
  stationDesc=11;
  wmoId=12;
  wmoBlock=13;
  year=15;
  month=16;
  day=17;
  hour=18;
  minute=19;
  sec=20;
  doy=21;
  timeIncr=22;
  incrS=23;
}

message Field {
  uint32 fxy = 1;
  string name = 2;
  repeated Field flds = 3;
  FldAction action = 4;
  FldType type = 5;
  uint32 min = 6;
  uint32 max = 7;
  string desc = 8;
  string units = 9;
  int32 scale = 10;     // bufr scale and offset
  int32 reference = 11;
  int32 bitWidth = 12;
}

message BufrIndex {
  string filename = 1;
  repeated Station stations = 2;
  Field root = 3;
  uint64 start = 4;   // msecs since epoch
  uint64 end = 5;
  uint64 nobs = 6;
}

//  cd netcdf-java/bufr/src/main/java
//  protoc --proto_path=. --java_out=. ucar/nc2/ft/point/bufr/bufrCdmIndex.proto