Protocol Documentation
Service for querying data and metadata from seismic files in Cognite Data Fusion
(CDF) seismic datastore We use the word File
to refer to a single seismic
file/dataset/cube. Queries on a file require it to have been previously ingested
into CDF using (ingest_service.proto)
Queries are divided in:
General information and headers for surveys and files
Information on a file's grid and positioning, such as coverage and range of
inlines and crosslines
Find a single trace in the file. A trace will include header, position
information and samples. More details about the trace format can be found on its
definition in (types.proto)
Get 2D vertical slices of samples (thus 1D arrays of traces). The slices can
be based on a single defined line or in an arbitrarily defined line with
interpolation.
Get 3D volumes of samples (thus 2D arrays of traces) defined by a region in
the horizontal plane
Get 2D horizontal slices of samples defined by a region in the horizontal
plane and a specific index in depth/time
Get the (calculated/interpolated) values of properties in the file/cube
given arbitrary positions
Metadata queries
Method Name | Request Type | Response Type | Description |
---|
GetSurvey | SurveyQueryRequest | GetSurveyResponse | Finds one survey given its name or id. Optionally, lists its associated files. |
ListSurveys | ListSurveysQueryRequest | SurveyWithFilesResponse | Lists all surveys owned by this project. Optionally, includes their lists of files. |
ListFiles | .google.protobuf.Empty | ListFilesResponse | Lists all files available, both owned by the authorized CDF project and shared with it |
SearchSurveys | SearchSurveyRequest | SurveyWithFilesResponse | Search surveys based on two criteria: 1. Coverage polygon of files in the survey are within an area delimited by a specified polygon 2. Filters on metadata of both the survey and the file. Both criteria are optional and can be combined for a more detailed search. |
GetFile | FileQueryRequest | GetFileResponse | Returns file metadata given its name or id. |
GetBinaryHeader | HeaderFileQueryRequest | GetBinaryHeaderResponse | Returns a binary header given its file name or id. |
GetTextHeader | HeaderFileQueryRequest | GetTextHeaderResponse | Returns a text header given its file name or id. |
GetFileDataCoverage | FileCoverageRequest | DataCoverageResponse | Returns the coverage for a given file identified by its id or name. The coverage is represented by a polygon either in WKT or geojson and represents the area covered by traces in the file. There can be holes in the polygon if traces do not exist in an area inside of it. DEPRECATE in favor of Geospatial APIs. |
GetFileLineRange | FileQueryRequest | LineRangeResponse | Returns the full range of the inlines and crosslines in the file, i.e. the minimum and maximum inline and crossline |
GetCrosslinesByInline | FileLineQueryRequest | AvailableLines | Returns the set of valid crossline indices for a specific inline, in a given file DEPRECATE: Move to GetFileLineRange. |
GetInlinesByCrossline | FileLineQueryRequest | AvailableLines | Returns the set of valid inline indices for a specific crossline, in a given file DEPRECATE: Move to GetFileLineRange. |
GetTraceByCoordinates | CoordinateTraceQueryRequest | Trace | Returns the trace in a file that is closest to a point given its coordinates (x,y) |
GetTracesByLine | LineTraceQueryRequest stream | Trace stream | Returns a trace for each coordinate (inline, xline) from the input stream |
GetSliceByLine | LineSliceQueryRequest | Trace stream | Returns all or a subset of traces in a slice (inline or crossline) given its index (and optionally from/to) DEPRECATED, use GetVolume instead. |
GetSliceByGeometry | GeometrySliceQueryRequest | Trace stream | Returns a slice with traces following a path determined by an arbitrary line. Depending on interpolating method, these can be either real traces in the file that are closest to the path or synthetic traces generated by interpolation of the traces in the file. |
GetCubeByLines | LineCubeRequest | Trace stream | Returns a volume with all traces inside a given range of inlines and a given range of crosslines DEPRECATED, use GetVolume instead. |
GetCubeByGeometry | GeometryCubeRequest | Trace stream | Returns a volume with all traces with x, y coordinates inside an arbitrary 2D polygon |
GetSegYFile | SegYQueryRequest | SegYQueryResponse stream | Returns a SEG-Y file. Can retrieve a full file or create a new cropped file filtering on areas of interest only. DEPRECATED, to be replaced with a command line tool or an SDK method for constructing a SEG-Y file by calling GetVolume |
GetSlabByLines | LineSlabRequest | SlabTrace stream | Returns a seismic slab by either horizon or constant depth and area constrained by a range of inlines and crosslines |
GetTimeSliceByGeometry | GeometryTimeSliceQueryRequest | SurfacePoint stream | Returns a horizontal slice for a given depth or time and area constrained by an arbitrary 2D polygon |
GetVolume | VolumeRequest | Trace stream | Volume queries |
Top
Service for ingestion and metadata updates of SEG-Y files into Cognite Data Fusion (CDF) seismic datastore
We use the word File
to refer to a single seismic file/dataset/cube
Surveys can have many files attached to them, with different attributes or processing stages, and every file must
belong to a survey
The expected order of ingestion is:
Register a survey, if it does not exist
Register a file
Files are expected to be previously uploaded to a Google Cloud Storage (GCS) bucket at this point, and the service needs
permission to this bucket in the form of a service account.
The RegisterFile endpoint will request the survey name or id, bucket address and the CRS used in this file
(e.g.: EDM50, WGS84), so be sure to have this information prior at hand.
Ingest the file
If the RegisterFile endpoint completes successfully, and your file is found in the bucket, you can now send a request to
the IngestFile endpoint, and an asynchronous process will be started remotely to download and process the file.
You can verify the status of this process by calling the Status endpoint with the id returned in the IngestFile endpoint
As soon as the status of the processing job is set to complete, data from the file will be available with the query service
When a file is registered in a CDF project, this project owns the file. It is then allowed to share access with other
CDF projects
Top
Messages from the query service of Seismic Datastore in Cognite Data Fusion
Field | Type | Label | Description |
---|
lines | int32 | repeated | |
Point defined by its x and y coordinates
Request a single trace from a file by coordinates (x AND y). If x and y don't fall in the coordinates of a trace,
will return the closest trace to it.
Field | Type | Label | Description |
---|
file | Identifier | | |
coordinates | CoordinateQuery | | |
max_radius | float | | only return traces if closer than this to the actual point in the file |
include_trace_header | bool | | |
Field | Type | Label | Description |
---|
polygon | Geometry | | |
Field | Type | Label | Description |
---|
file | Identifier | | name or id of the file |
crs | CRS | | [optional] If CRS provided converts coverage to given CRS. Otherwise, will return in the file's original CRS |
in_wkt | bool | | set this to true to return in WKT format. Otherwise, response will be in geojson format by default |
Field | Type | Label | Description |
---|
file | Identifier | | name or id of the file |
line | int32 | | number of the selected inline or crossline in the file |
Field | Type | Label | Description |
---|
file | Identifier | | name or id of the file |
Request a volume of traces from a file with coordinates inside an arbitrary polygon
Request a slice of traces from a file by coordinates of start and end of an arbitrary line
Request a time slice from a file and filter by coordinates inside an arbitrary polygon
Field | Type | Label | Description |
---|
file | Identifier | | name or id of the file |
include_raw_header | bool | | set to true to include the raw header in the response (default: false) |
Range of inline, crossline and time indices defining a volume
Request a volume of traces from a file by range of inlines and crosslines
Request a volume below and above a time slice from a file and filter by range of inlines and crosslines
Request a slice of traces from a file by index (inline OR crossline), and optionally specify min and max range
Request a single trace from a file by index (inline AND crossline)
Field | Type | Label | Description |
---|
files | File | repeated | |
Field | Type | Label | Description |
---|
list_files | bool | | set to true to list the survey files in the response (default: false) |
include_metadata | bool | | set to true to include metadata in the response (default: false) |
include_grid_transformation | bool | | set to true to include the grid transformation in the response, if available (default: false) |
include_custom_coverage | bool | | set to true to include the custom survey coverage in the response, if available (default: false) |
Field | Type | Label | Description |
---|
survey | Identifier | | name or id of the survey |
Request a pseudo-trace (sequence of values) representing the values for the described path in a file
Request to search surveys inside a polygon or by metadata
Filter the area included in the SEGY file by a polygon defined either by spatial coordinates
or by a set of inline and crossline indices
Field | Type | Label | Description |
---|
content | bytes | | |
Range of z_values to use in time/depth slice queries
Field | Type | Label | Description |
---|
z_values | int32 | repeated | |
Field | Type | Label | Description |
---|
survey | Identifier | | name or id of the survey |
list_files | bool | | set to true to list the survey files in the response (default: false) |
include_metadata | bool | | set to true to include metadata in the response (default: false) |
include_coverage | CoverageParameters | | set this field to include coverage in the response (default: false) |
include_grid_transformation | bool | | set to true to include the grid transformation in the response, if available (default: false) |
include_custom_coverage | bool | | set to true to include the custom survey coverage in the response, if available (default: false) |
The minimum and maximum values of all traces in a specific file
Field | Type | Label | Description |
---|
min_value | float | | |
max_value | float | | |
Request a volume from a file by range of inlines, crosslines and time
Top
Messages from the ingestion service of Seismic Datastore in Cognite Data Fusion
[Example]
{"file": {"id": "97305892-d622-4425-8530-3029b740842e"} }
Field | Type | Label | Description |
---|
file | Identifier | | [required] Either name or id of a file previously registered with /RegisterFile |
keep_registered | bool | | If set to true, will delete contents of file (undo the ingestion), but keep the file registered. If set to false, will completely remove the file from database. If no option is set, default is false |
[Example]
{"survey": {"name": "survey_name"} }
Field | Type | Label | Description |
---|
survey | Identifier | | [required] Either name or id of a survey previously registered with /RegisterSurvey |
Field | Type | Label | Description |
---|
file | Identifier | | [required] Either name or id of a file |
project | Identifier | | [required] Either name or id of a project |
add | bool | | If neither add or remove are set, or if both are set to true, add will be assumed |
Add project access to this file |
| remove | bool | | Remove project access from this file |
[Example]
{"file": {"id": "97305892-d622-4425-8530-3029b740842e"} }
Field | Type | Label | Description |
---|
file | Identifier | | [required] Either name or id of a file previously registered with /RegisterFile |
path | string | | [optional] New path. Example: "gs://cognite-seismic-eu/samples/" |
name | string | | [optional] New (unique) filename. Example: "DN1302M03R16_MERGED_KPSDM_00-32_DEG_T.sgy" |
metadata | EditFileRequest.MetadataEntry | repeated | [optional] New metadata |
crs | CRS | | [optional] Official name of the CRS used. Example: "EPSG:23031" |
inline_offset | google.protobuf.Int32Value | | [optional] Inline number field in the trace headers. Defaults to 189 as per the SEG-Y rev1 specification |
crossline_offset | google.protobuf.Int32Value | | [optional] Crossline number field in the trace headers. Defaults to 193 as per the SEG-Y rev1 specification |
cdp_x_offset | google.protobuf.Int32Value | | [optional] X coordinate of ensemble (CDP) position in trace headers. Defaults to 181 as per the SEG-Y rev1 specification |
cdp_y_offset | google.protobuf.Int32Value | | [optional] Y coordinate of ensemble (CDP) position in trace headers. Defaults to 185 as per the SEG-Y rev1 specification |
external_id | ExternalId | | [optional] An external identifier - matches service contract field |
source_group_scalar_override | google.protobuf.FloatValue | | [optional] Multiplier for CDP-X and CDP-Y values, overrides scalar factor obtained from trace header. Note that this is a floating point multiplier used directly to scale CDP-X and CDP-Y values, and it is not interpreted in the manner of the source group scalar trace header field in the SEG-Y specification. That is: To divide by 100, specify 0.01, not -100. Negative values and values greater than 1 are not permitted. To remove the override from a file where an override has previously been set, set the source_group_scalar_override to 0 or NaN. The next ingestion processing of a file will then use the source group scalar values found in trace headers. |
Field | Type | Label | Description |
---|
file | File | | |
path | string | | |
crs | CRS | | |
inline_offset | google.protobuf.Int32Value | | [optional] Inline number field in the trace headers. Defaults to 189 as per the SEG-Y rev1 specification |
crossline_offset | google.protobuf.Int32Value | | [optional] Crossline number field in the trace headers. Defaults to 193 as per the SEG-Y rev1 specification |
cdp_x_offset | google.protobuf.Int32Value | | [optional] X coordinate of ensemble (CDP) position in trace headers. Defaults to 181 as per the SEG-Y rev1 specification |
cdp_y_offset | google.protobuf.Int32Value | | [optional] Y coordinate of ensemble (CDP) position in trace headers. Defaults to 185 as per the SEG-Y rev1 specification |
source_group_scalar_override | google.protobuf.FloatValue | | [optional] Multiplier for CDP-X and CDP-Y values, overrides scalar factor obtained from trace header |
[Example]
{"survey": {"id": "97305892-d622-4425-8530-3029b740842e"}, "name": "new name"}
Field | Type | Label | Description |
---|
survey | Identifier | | [required] Either name or id of a survey previously registered with /RegisterSurvey |
name | string | | [optional] New name |
metadata | EditSurveyRequest.MetadataEntry | repeated | [optional] New metadata |
external_id | ExternalId | | [optional] External id matching service contract type |
crs | CRS | | [optional] new CRS used by all members |
grid_transformation | SurveyGridTransformation | | [optional] Affine transformation from grid bins to coordinates |
custom_coverage | CustomSurveyCoverage | | [optional] Customer-provided custom survey coverage |
Field | Type | Label | Description |
---|
survey | Survey | | |
[Example]
{"file": {"name": "ABP16M03-FMIG-OBC-PSDM-FULL-STACK-T.MIG_FIN.POST_STACK..JS-021837.segy"} }
Field | Type | Label | Description |
---|
file | Identifier | | [required] Either name or id of a file previously registered with /RegisterFile |
start_step | FileStep | | [optional] Selected step to start ingestion. Leave blank to start from last completed step. [Accepted values] 1 -- insert binary and text headers 2 -- insert trace headers 3 -- insert trace data 4 -- compute coverage polygon and additional metadata (trace count, valid lines, etc) 6 -- insert trace offset indices [Use cases] Usual ingestion: If the last successful step was 0 (REGISTER), the file will be fully ingested regardless of start_step Completing a failed ingestion: If the last successful step was 3 (INSERT_DATA), and no start step is selected, only coverage will be computed. Previously ingested headers and traces will be preserved in this case. Forcing reingestion: If start_step is 1 (INSERT_FILE_HEADERS), regardless of previous ingestion status, all headers and data will be deleted and the whole file will be forcefully reingested Forcing a single step to be rerun: If the file is ingested (last step is COMPUTE_COVERAGE), by using start_step = 4 (COMPUTE_COVERAGE), for example, only coverage will be computed while headers and traces will be preserved |
target_storage_tier_name | string | | [optional as of 2020-11-01, will be required at some later time] Target storage tier for this file. If empty a bigtable-based storage will be used.A storage tier is a defined facility for storing the trace data associated with a seismic volume. The default storage facility is based on Cloud Bigtable, but it is also possible to leave trace data stored in SEG-Y files in Cloud Storage, only retaining a compact index of file data in fast storage to facilitate retrieval of data from Cloud Storage in a performant manner. |
[Accepted values] Accepted values are defined by the tenant configuration, and allow for optimizing tradeoffs between storage cost, retrieval performance, numeric precision and sampling.
Note that currently only one storage tier per trace store is supported, so ingesting an already ingested file will result in the file's data being removed from the previously active storage tier. |
Field | Type | Label | Description |
---|
job_id | string | | job id that can be used to query for status |
file_id | string | | |
Field | Type | Label | Description |
---|
file | Identifier | | [required] Either name or id of a file |
Field | Type | Label | Description |
---|
project | Project | repeated | |
[Example]
{
"survey": {"name": "surveyname"},
"name": "ABP16M03-FMIG-OBC-PSDM-FULL-STACK-T.MIG_FIN.POST_STACK..J.segy",
"path": "gs://cognite-seismic-eu/samples/from-diskos-disks",
"crs": { "crs": "EPSG:23031"}
}
Field | Type | Label | Description |
---|
survey | Identifier | | [required] Either name or id of a survey previously registered with /RegisterSurvey |
path | string | | [required if file is not synthetic] Path including protocol, bucket and directory structure. Example: "gs://cognite-seismic-eu/samples/" |
name | string | | [required] Unique filename including extension. Example: "DN1302M03R16_MERGED_KPSDM_00-32_DEG_T.sgy". The name must be unique across buckets and can be used to identify this file in query requests |
metadata | RegisterFileRequest.MetadataEntry | repeated | [optional] |
crs | CRS | | [required] Official name of the CRS used. Example: "EPSG:23031" |
is_temporary | google.protobuf.BoolValue | | [optional] tells whether file is temporary (writeable) or not. False by default |
inline_offset | google.protobuf.Int32Value | | [optional] Inline number field in the trace headers. Defaults to 189 as per the SEG-Y rev1 specification |
crossline_offset | google.protobuf.Int32Value | | [optional] Crossline number field in the trace headers. Defaults to 193 as per the SEG-Y rev1 specification |
cdp_x_offset | google.protobuf.Int32Value | | [optional] X coordinate of ensemble (CDP) position in trace headers. Defaults to 181 as per the SEG-Y rev1 specification |
cdp_y_offset | google.protobuf.Int32Value | | [optional] Y coordinate of ensemble (CDP) position in trace headers. Defaults to 185 as per the SEG-Y rev1 specification |
external_id | ExternalId | | [optional] An external identifier - matches service contract field |
source_group_scalar_override | google.protobuf.FloatValue | | [optional] Multiplier for CDP-X and CDP-Y values, overrides scalar factor obtained from trace header. Must be in the range (0,1]. Note that this is a floating point multiplier used directly to scale CDP-X and CDP-Y values, and it is not interpreted in the manner of the source group scalar trace header field in the SEG-Y specification. That is: To divide by 100, specify 0.01, not -100. Negative values, 0 and values greater than 1 are not permitted when registering a file, although 0 may be used in the EditFile call to unset this field. |
Field | Type | Label | Description |
---|
file | File | | |
[Example]
{"name": "surveyname", "metadata": {"location": "underwater"}, "external_id": "surveyname-external" }
Field | Type | Label | Description |
---|
survey | Survey | | |
[Example]
{"job_id": "1e9a4f9b-7c15-44dd-bbbb-e9e9fb83e401"}
Top
Messages for types used in ingestion and query services in Seismic Datastore in Cognite Data Fusion
Field | Type | Label | Description |
---|
crs | string | | |
Basic type representing (x,y) coordinate in the given CRS
Field | Type | Label | Description |
---|
crs | string | | The Coordinate Reference System of the coordinate. Generally should be an EPSG code including the EPSG: prefix, for example EPSG:23031 |
x | float | | The x value of the coordinate |
y | float | | The y value of the coordinate |
Parameters for requesting coverage of survey
Field | Type | Label | Description |
---|
crs | CRS | | [optional] If CRS provided converts coverage to given CRS. Otherwise, will return in the survey's original CRS |
in_wkt | bool | | set this to true to return in WKT format. Otherwise, response will be in geojson format by default |
Customer-provided custom coverage for surveys
Field | Type | Label | Description |
---|
custom_coverage | Geometry | | Overrides survey coverage with the provided custom coverage geometry |
no_custom_coverage | CustomSurveyCoverage.NoCustomCoverage | | Specifies that no custom coverage is provided, so survey coverage is computed from the seismicstores in the survey |
Have the seismic service try to deduce the affine transformation for each file by
reading trace coordinates
Correlated grid indices and coordinates
Field | Type | Label | Description |
---|
iline | int32 | | The inline number. Within a 3D survey, a inline represents a seismic line parallel to the direction in which the data was adquired. |
xline | int32 | | The xline number. Within a 3D survey, a xline represents a seismic line perpendicular to the direction in which the data was adquired. |
x | float | | The x value of the coordinate |
y | float | | The y value of the coordinate |
Field | Type | Label | Description |
---|
external_id | string | | |
File or dataset or cube derived from a single SEG-Y file
The GeoJSON format (<a href="https://tools.ietf.org/html/rfc7946">RFC 7946</a>)
Supported geometry: Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, and GeometryCollection.
Example:
<pre>{
"type": "Point",
"coordinates": [100.0, 0.0]
}</pre>
Geometry can be specified using either wkt or geoJSON. CRS is always required.
Specify either id or name to find a file or survey.
Range of inline and crossline indices defining a 2D region
Object to store the line range. From and to are optional
Specify either inline OR crossline
Field | Type | Label | Description |
---|
iline | int32 | | The inline number. Within a 3D survey, a inline represents a seismic line parallel to the direction in which the data was adquired. |
xline | int32 | | The xline number. Within a 3D survey, a xline represents a seismic line perpendicular to the direction in which the data was adquired. |
Specify the transformation by an origin point and the crossline azimuth
Format inspired by IOGP guidance note 373-7-2 section 2.3.2.4.
https://ge0mlib.com/papers/Guide/IOGP/373-07-2-1_2017.pdf
Field | Type | Label | Description |
---|
handedness | Handedness | | |
origin | DoubleTraceCoordinates | | A point in the grid |
iline_bin_width | float | | The bin width along the inline axis |
xline_bin_width | float | | The bin width along the crossline axis |
xline_azimuth | float | | Map bearing of the crossline axis in clockwise degrees from north |
iline_bin_inc | int32 | | Inline increment corresponding to a bin |
xline_bin_inc | int32 | | Crossline increment corresponding to a bin |
Point defined by its inline and crossline indices
Field | Type | Label | Description |
---|
iline | int32 | | The inline number. Within a 3D survey, a inline represents a seismic line parallel to the direction in which the data was adquired. |
xline | int32 | | The xline number. Within a 3D survey, a xline represents a seismic line perpendicular to the direction in which the data was adquired. |
Wrapper over Trace type that additionally provide information about the range of z values
included in the trace.
Basic type to represent a point in a surface defined by a horizontal grid
Used in horizontal slice queries
Field | Type | Label | Description |
---|
iline | int32 | | The inline number. Within a 3D survey, a inline represents a seismic line parallel to the direction in which the data was adquired. |
xline | int32 | | The xline number. Within a 3D survey, a xline represents a seismic line perpendicular to the direction in which the data was adquired. |
value | float | | |
A survey represents a collection of files in the same area
Specify the affine transformation between line indices and coordinates
Basic type to represent a seismic trace
Used in trace, vertical slices and volume queries
Contains the samples and information on positioning
If a trace is an original trace in the file, it can optionally contain the trace header.
This is not valid for traces that are synthetically generated from interpolation.
Field | Type | Label | Description |
---|
trace_header | bytes | | |
iline | google.protobuf.Int32Value | | The inline number. Within a 3D survey, a inline represents a seismic line parallel to the direction in which the data was adquired. |
xline | google.protobuf.Int32Value | | The xline number. Within a 3D survey, a xline represents a seismic line perpendicular to the direction in which the data was adquired. |
trace | float | repeated | The underlying array of floats representing samples |
coordinate | Coordinate | | |
Specify the transformation by giving the coordinates of three or more corners
Well-known text representation of geometry (<a href="http://www.opengeospatial.org/standards/sfa">WKT</a>)
Field | Type | Label | Description |
---|
geometry | string | | |
Name | Number | Description |
---|
REGISTER | 0 | |
INSERT_FILE_HEADERS | 1 | |
INSERT_TRACE_HEADERS | 2 | |
INSERT_DATA | 3 | |
COMPUTE_COVERAGE | 4 | |
COMPUTE_GRID | 5 | |
COMPUTE_TRACE_INDICES | 6 | |
DELETING | 254 | |
DELETE | 255 | |
Name | Number | Description |
---|
RIGHTHANDED | 0 | inline axis is 90 deg clockwise from crossline AKA EPSG code 9666 |
LEFTHANDED | 1 | inline axis is 90 deg counterclockwise from crossline AKA EPSG code 1049 |
Name | Number | Description |
---|
INVALID_SOURCE | 0 | |
FILE_SOURCE | 1 | |
TRACE_WRITER | 2 | TraceWriter |
Name | Number | Description |
---|
NEAREST_TRACE | 0 | |
INVERSE_DISTANCE_WEIGHTING | 1 | |
Name | Number | Description |
---|
NONE | 0 | |
QUEUED | 1 | |
IN_PROGRESS | 2 | |
SUCCESS | 3 | |
FAILED | 4 | |
TIMEOUT | 5 | |
.proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
---|
double | | double | double | float | float64 | double | float | Float |
float | | float | float | float | float32 | float | float | Float |
int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum |
uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) |
uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) |
sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum |
fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) |
fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum |
sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum |
bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass |
string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) |
bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) |