All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ucar.nc2.stream.ncStream.proto Maven / Gradle / Ivy

The newest version!
syntax = "proto3";

option java_package = "ucar.nc2.stream";
option java_outer_classname = "NcStreamProto";

message Attribute {
  enum Type {                      // < 5.0
    STRING = 0;
    BYTE = 1;
    SHORT = 2;
    INT = 3;
    LONG = 4;
    FLOAT = 5;
    DOUBLE = 6;
  }
  string name = 1;
  Type type = 2;           // < 5.0
  uint32 len = 3;
  bytes data = 4;                   // not needed if len == 0, Attribute with name but no value
  repeated string sdata = 5;        // used for string data
  bool unsigned = 6;                // not used
  DataType dataType = 7;   // 5.0: cant use STRUCTURE or SEQUENCE or OPAQUE or ENUM; CHAR deprecated, use STRING
}

enum DataType {
  CHAR = 0;
  BYTE = 1;
  SHORT = 2;
  INT = 3;
  LONG = 4;
  FLOAT = 5;
  DOUBLE = 6;
  STRING = 7;
  STRUCTURE = 8;
  SEQUENCE = 9;
  ENUM1 = 10;
  ENUM2 = 11;
  ENUM4 = 12;
  OPAQUE = 13;

  UBYTE = 14;
  USHORT = 15;
  UINT = 16;
  ULONG = 17;
}

message Dimension {
  string name = 1;   // short name - optional when private
  uint64 length = 2; // optional when vlen, may be zero (unlimited no data yet)
  bool isUnlimited = 3; // is this needed ??
  bool isVlen = 4;
  bool isPrivate = 5;
}

message Variable {
  string name = 1; // short name
  DataType dataType = 2;
  repeated Dimension shape = 3;   // actual dimension instead of reference
  repeated Attribute atts = 4;
  bool unsigned = 5;    // not used >= 5
  bytes data = 6;        // "immediate" - store small data in header
  string enumType = 7;   // EnumTypedef name, only for enum types
}

message Structure {
  string name = 1;         // short name
  DataType dataType = 2;   // STRUCTURE or SEQUENCE
  repeated Dimension shape = 3;     // actual dimension instead of reference
  repeated Attribute atts = 4;
  repeated Variable vars = 5;     // members
  repeated Structure structs = 6; // struct members
}

message EnumTypedef {
  message EnumType {
    uint32 code = 1;
    string value = 2;
  }
  string name = 1;
  repeated EnumType map = 2;
}

message Group {
  string name = 1;                // short name
  repeated Dimension dims = 2;
  repeated Variable vars = 3;
  repeated Structure structs = 4;
  repeated Attribute atts = 5;
  repeated Group groups = 6;
  repeated EnumTypedef enumTypes = 7;
}

message Header {
  string location = 1;
  string title = 2;  // ??
  string id = 3;    // ??
  Group root = 4;
  uint32 version = 5;
}

//////////////////////////////////

message Error {
  string message = 1;
  uint32 code = 2;
}

enum Compress {
  NONE = 0;
  DEFLATE = 1;
}

message Range {
  uint64 start = 1;
  uint64 size = 2;
  uint64 stride = 3;
}

message Section {
  repeated Range range = 1;
}

////////////////////////////////////////////////////////
// Data version 1

message Data {
  string varName = 1;          // full escaped name.
  DataType dataType = 2;
  Section section = 3;         // not required for SEQUENCE
  oneof bigend_present {
    bool bigend = 4;           // [default=true] in proto2
  }
  uint32 version = 5;          // version=2 for proto2, >=3 for proto3 (v5.0+)
  Compress compress = 6;
  bool vdata = 7;
  uint32 uncompressedSize = 8;
}

message StructureData {
  repeated uint32 member = 1; // list of members present, if none then all, these are the index in Structure
  bytes data = 2; // fixed length data
  repeated uint32 heapCount = 3; // heap String count
  repeated string sdata = 4; // Strings
  uint64 nrows = 5; // [default = 1] number of rows in this message
  uint32 rowLength = 6;  // length in bytes of each row
}

//////////////////////////////////
// Data version 2 - col oriented

message DataCol {
  string name = 1;      // fullname for top, shortname for member
  DataType dataType = 2;
  Section section = 3;
  bool bigend = 4;
  uint32 version = 5;
  bool isVlen = 7;
  uint32 nelems = 9;

  // oneof
  bytes primdata = 10;              // rectangular, primitive array
  repeated string stringdata = 11;  // string dataType
  repeated uint32 vlens = 12;       // isVlen true
  repeated bytes opaquedata = 13;   // opaque dataType

  // structures
  ArrayStructureCol structdata = 14;  // structure/seq dataType
}

message ArrayStructureCol {
  repeated DataCol memberData = 1;
}

//////////////////////////////////
// Data version 2 - row oriented

message DataRow {
  string fullName = 1;
  DataType dataType = 2;
  Section section = 3;
  bool bigend = 4;
  uint32 version = 5;
  bool isVlen = 7;
  uint32 nelems = 9;

  bytes primdata = 10;              // rectangular, primitive array
  repeated string stringdata = 11;  // string dataType
  repeated uint32 vlens = 12;   // vlen lengths
  repeated bytes opaquedata = 13;   // opaque dataTypes
  ArrayStructureRow structdata = 14;// structure/seq dataType
}

message Member {
  string shortName = 1;
  DataType dataType = 2;
  repeated uint32 shape = 3;  // or section?
  bool isVlen = 4;
}

message ArrayStructureRow {
  repeated Member members = 1;
  uint64 nrows = 5;      // number of rows in this message
  uint32 rowLength = 6;  // length in bytes of each row

  bytes fixdata = 10;            // fixed data
  repeated string stringdata = 11;  // string dataType
  repeated bytes bytedata = 13;  // opaque dataType and vlens
  repeated ArrayStructureRow structdata = 14;  // structure/seq dataType
}

//////////////////////////////////
// cd cdm/src/main/java
// protoc --proto_path=. --java_out=. ucar/nc2/stream/ncStream.proto
// requires Protobuf 3+




© 2015 - 2024 Weber Informatics LLC | Privacy Policy