Skip to content

Where is the grd format described? #1

@hsonne

Description

@hsonne

Hi @robetatis,

  • Where is the format of the binary file described? Can you provide a link?
  • We need to know the number of grid cells, is this information (maybe along with other metadata) not somehow contained in the file?
  • If not, it is important to pass the "correct" values for nx and ny to the main function, those that "match" the actual input file. It should be checked somehow if the file and the values for nx and ny fit together.
  • I did a test with one of your test files:
# Read all raw bytes from the file
con <- file("SEVP_CLI_CHN_MERGE_CMP_PRE_HOUR_GRID_0.10-2008043000.grd", "rb")
x <- readBin(con, what = "raw", n = 1e7)
close(con)

# Number of bytes in the file
length(x) # 2464000

# Expected number of bytes (number of records + 1 first record skipped)
nx = 700
ny = 440
(nx * ny + 1) * 4 # 1232004

There are 2464000 bytes in the file but we are only reading 1232004. Are nx and ny correct for the given file? If yes, what is contained in the remaining bytes of the file? The actual number of bytes is almost exactly twice the number of bytes that we actually read. Are the values maybe coded in 8 bytes instead of 4 bytes?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions