<p>In general computing, a '<a href="https://en.wikipedia.org/wiki/Block_(data_storage)" rel="noreferrer">block</a>' is a data storage unit with a fixed total size / storing a fixed number of records. In essence it's just a 'section of' data. If the data exceed the size of a single block, they can be stored in multiple blocks. But the actual space taken up on disk will always be some multiple of the block size, because the FITS file 'allocates space' 2880 bytes at a time. If there's leftover space at the end, it's just left empty. Here's a helpful diagram, courtesy <a href="http://www.diyspaceprojects.com/image-file-processing-fits-and-android/" rel="noreferrer">DIY Space Projects</a>:</p>
<p><a href="https://i.sstatic.net/niUHS.png" rel="noreferrer"><img src="https://i.sstatic.net/niUHS.png" alt="Image showing the header unit and data unit broken into 2880 byte blocks." /></a></p>
<p>You can see that the entire header unit is stored over multiple blocks - if one section of the header exceeds the 2880 byte allocation, then another block is added on. (Note that the &quot;END&quot; text there is literal - the header officially ends once it reaches this marker, though it may still be padded out with empty space until it reaches 2880 units.) <strong>In your example</strong>, where you reach 2880 bytes and then have one extra character to store, that extra character 'costs' 2880 bytes on disk. The system does, in fact, need to allocate <em>two</em> blocks, and the second one will just store the last character (plus the END indicator).</p>
<p>To be honest, this is a fairly low-level detail of the file format that most people don't need to know or interact with. It's a formality, originally used to make file reading and writing more effective on systems that had limitations we no longer regularly deal with. In general, if you are the consumer of a FITS file (or a consumer of a library that makes FITS files), you don't need to know the gritty details of how this works, because it's already abstracted away for you.</p>

CC BY-SA 4.0
2022-07-16T10:11:13.440Z
Thank you for your comment. I have one more question. "Data unit" also can have multiple blocks? (I wonder because in the picture you uploaded, "data unit" seems like it has only one block)
BAO
CC BY-SA 4.0
2022-07-19T07:11:50.700Z
@BAO The data unit can have multiple blocks, yes.
Slate
CC BY-SA 4.0
2022-07-10T19:48:33.073Z
2022-07-10T19:48:33.073Z
Slate
<p>I am studying FITS file, through this: <a href="https://fits.gsfc.nasa.gov/standard40/fits_standard40aa-le.pdf" rel="nofollow noreferrer">Definition of FITS</a></p>
<p>They said Fits block is like below(page3).</p>
<blockquote>
<p>A sequence of 2880 eight-bit bytes aligned on
2880-byte boundaries in the FITS file, most commonly either
a header block or a data block. Special records are another
infrequently used type of FITS block. This block length was
chosen because it is evenly divisible by the byte and word
lengths of all known computer systems at the time FITS was
developed in 1979.</p>
</blockquote>
<p>It is hard to understand this concept because one HDU's data or header has more information than &quot;2880 byte&quot;.</p>
<p>For example, one of the header's character exceed 2880, and 1 character is charged 1 byte.</p>
<p>What's the point I miss?</p>

CC BY-SA 4.0
2022-07-10T10:18:53.067Z
The header and the data each consist of one *or more* (usually more) blocks. (You can define the size and shape of an individual page for a book. But the book is allowed to have more than one page.)
Peter Erwin
CC BY-SA 4.0
2022-07-10T17:12:18.213Z
@PeterErwin Thank you for comment. I want to ask what's the block part in header or data. Is it just one keyword in header and just one element in data?
BAO
CC BY-SA 4.0
2022-07-10T17:26:16.893Z
From the astropy io.fits documentation: "FITS headers must be written in 2880 byte blocks, large enough for 36 keywords per block (including the END keyword in the final block). Typical headers have somewhere between 1 and 4 blocks, though sometimes more."

The blocks are a very low level of allocation; they don't correspond to individual keywords or elements of data.
Peter Erwin
<fits>
What's mean of the "FITS BLOCK"?
BAO
# What's mean of the "FITS BLOCK"?

(Asked by: username_0 on 2022-07-10)

I am studying FITS file, through this: [Definition of FITS](https://fits.gsfc.nasa.gov/standard40/fits_standard40aa-le.pdf)

They said Fits block is like below(page3).

> A sequence of 2880 eight-bit bytes aligned on
> 2880-byte boundaries in the FITS file, most commonly either
> a header block or a data block. Special records are another
> infrequently used type of FITS block. This block length was
> chosen because it is evenly divisible by the byte and word
> lengths of all known computer systems at the time FITS was
> developed in 1979.

It is hard to understand this concept because one HDU's data or header has more information than "2880 byte".

For example, one of the header's character exceed 2880, and 1 character is charged 1 byte.

What's the point I miss?

**Tags:** fits

> **Comments:**
> **username_1**: The header and the data each consist of one *or more* (usually more) blocks. (You can define the size and shape of an individual page for a book. But the book is allowed to have more than one page.)  
> **username_0**: @PeterErwin Thank you for comment. I want to ask what's the block part in header or data. Is it just one keyword in header and just one element in data?  
> **username_1**: From the astropy io.fits documentation: "FITS headers must be written in 2880 byte blocks, large enough for 36 keywords per block (including the END keyword in the final block). Typical headers have somewhere between 1 and 4 blocks, though sometimes more."  The blocks are a very low level of allocation; they don't correspond to individual keywords or elements of data.  

---

## 1 answers

### Answer by username_2 on 2022-07-10. Score: 6 | Accepted answer

In general computing, a '[block](https://en.wikipedia.org/wiki/Block_(data_storage))' is a data storage unit with a fixed total size / storing a fixed number of records. In essence it's just a 'section of' data. If the data exceed the size of a single block, they can be stored in multiple blocks. But the actual space taken up on disk will always be some multiple of the block size, because the FITS file 'allocates space' 2880 bytes at a time. If there's leftover space at the end, it's just left empty. Here's a helpful diagram, courtesy [DIY Space Projects](http://www.diyspaceprojects.com/image-file-processing-fits-and-android/):

[![Image showing the header unit and data unit broken into 2880 byte blocks.](https://i.sstatic.net/niUHS.png)](https://i.sstatic.net/niUHS.png)

You can see that the entire header unit is stored over multiple blocks - if one section of the header exceeds the 2880 byte allocation, then another block is added on. (Note that the "END" text there is literal - the header officially ends once it reaches this marker, though it may still be padded out with empty space until it reaches 2880 units.) **In your example**, where you reach 2880 bytes and then have one extra character to store, that extra character 'costs' 2880 bytes on disk. The system does, in fact, need to allocate *two* blocks, and the second one will just store the last character (plus the END indicator).

To be honest, this is a fairly low-level detail of the file format that most people don't need to know or interact with. It's a formality, originally used to make file reading and writing more effective on systems that had limitations we no longer regularly deal with. In general, if you are the consumer of a FITS file (or a consumer of a library that makes FITS files), you don't need to know the gritty details of how this works, because it's already abstracted away for you.

> **Comments:**
> **username_0**: Thank you for your comment. I have one more question. "Data unit" also can have multiple blocks? (I wonder because in the picture you uploaded, "data unit" seems like it has only one block)  
> **username_2**: @username_0 The data unit can have multiple blocks, yes.  

---

