FITS——灵活的图像传输系统
司机简称
FITS
生成依赖项
利比西奥
FITS是天文学家主要使用的一种格式,但它是一种相对简单的格式,支持任意类型的图像和多光谱图像,因此已经被应用到GDAL中。FITS支持是根据标准实现的 CFITSIO library ,为了启用配合支持,您必须在系统上安装这些组件(请参见 notes on CFITSIO linking ). 支持读取和写入FITS文件。
从3.0版开始,地理参考系统支持通过转换WCS(世界坐标系)关键字来实现。只有经纬度系统(参见 FITS standard document )已经实施,其中遥感处理是常用的。由于FITS/WCS标准中缺少三维基准信息,因此使用建议的行星延伸来转换半径和目标体 here .
打开文件时,FITS文件中存在的非标准头关键字将复制到数据集的元数据中,以便通过GDAL方法进行访问。类似地,当关闭GDAL句柄时,用户在数据集元数据中定义的非标准头关键字将写入FITS文件。
对于熟悉CFITSIO库的人,请注意:在GDAL<v3.0中,由于FITS文件中存在BSCALE和BZERO头关键字而触发的数据值的自动重新缩放是禁用的。这些头关键字可以通过数据集元数据访问和更新,与任何其他头关键字相同,但它们不影响从文件读取/写入数据值。从3.0版开始,BZERO和BSCALE关键字通过标准管理 GDALRasterBand::GetOffset()
/ GDALRasterBand::SetOffset()
和 GDALRasterBand::GetScale()
/ GDALRasterBand::SetScale()
GDAL函数,不再称为元数据。
多图像支持
从gdal3.2开始,支持在主HDU之后包含一个或多个扩展名的多扩展名FITS(MEF)文件。当找到2个以上的图像hdu时,它们被报告为子数据集。
给定子数据集/HDU的连接字符串为 FITS:"filename.fits":hdu_number
二进制表支持
从gdal3.2开始,二进制表将作为向量层公开(gdal3.2.1的更新和创建支持)。
FITS数据类型映射到OGR数据类型,如下所示:
TFORM值 |
TSCAL,TOFFSET值 |
发生次数 |
OGR字段类型 |
OGR字段子类型 |
---|---|---|---|---|
“L”(逻辑) |
忽略 |
1 |
OFTInteger |
OFSTBoolean |
“L”(逻辑) |
忽略 |
> 1 |
OFTIntegerList |
OFSTBoolean |
“X”(位) |
忽略 |
每个位映射到一个OGR字段 |
OFTInteger |
OFSTNone |
“B”(无符号字节) |
1,0(无符号字节)或1,-128(有符号字节) |
1 |
OFTInteger |
OFSTNone |
“B”(无符号字节) |
1,0(无符号字节)或1,-128(有符号字节) |
> 1 |
OFTIntegerList |
OFSTNone |
“I”(16位有符号整数) |
1, 0 |
1 |
OFTInteger |
第16节 |
“I”(16位整数,解释为无符号) |
1, 32768 |
1 |
OFTInteger |
OFSTNone |
“I”(16位有符号整数) |
(1,0)和(132768)除外 |
1 |
OFTReal |
OFSTNone |
“I”(16位整数) |
1, 0 |
>1 |
OFTIntegerList |
第16节 |
“I”(16位整数,解释为无符号) |
1, 32768 |
>1 |
OFTIntegerList |
OFSTNone |
“I”(16位有符号整数) |
除了(1,0)和(132768) |
> 1 |
OFTRealList |
OFSTNone |
'J'(32位有符号整数) |
1, 0 |
1 |
OFTInteger |
OFSTNone |
'J'(32位整数,解释为无符号) |
1, 2147483648 |
1 |
OFTInteger |
OFSTNone |
'J'(32位有符号整数) |
除(1,0)和(1,2147483648)外 |
1 |
OFTReal |
OFSTNone |
'J'(32位整数) |
1, 0 |
>1 |
OFTIntegerList |
OFSTNone |
'J'(32位整数,解释为无符号) |
1, 2147483648 |
>1 |
OFTIntegerList |
OFSTNone |
'J'(32位有符号整数) |
除(1,0)和(1,2147483648)外 |
> 1 |
OFTRealList |
OFSTNone |
“K”(64位有符号整数) |
1, 0 |
1 |
整数64 |
OFSTNone |
“K”(64位有符号整数) |
除了(1,0) |
1 |
OFTReal |
OFSTNone |
“K”(64位有符号整数) |
1, 0 |
> 1 |
整数64 |
OFSTNone |
“K”(64位有符号整数) |
除了(1,0) |
> 1 |
OFTRealList |
OFSTNone |
“A”(字符) |
忽略 |
如果TFORM='Axxx'并且没有TDIM头 |
OFTString |
OFSTNone |
“A”(字符) |
忽略 |
用于2D字段的TDIM,或可变长度('PA') |
OFTStringList |
OFSTNone |
“E”(单精度浮点) |
1, 0 |
1 |
OFTReal |
浮动32 |
“E”(单精度浮点) |
除了(1,0) |
1 |
OFTReal |
OFSTNone |
“E”(单精度浮点) |
1, 0 |
> 1 |
OFTRealList |
浮动32 |
“E”(单精度浮点) |
除了(1,0) |
> 1 |
OFTRealList |
OFSTNone |
“D”(双精度浮点) |
任何 |
1 |
OFTReal |
OFSTNone |
“D”(双精度浮点) |
任何 |
> 1 |
OFTRealList |
OFSTNone |
“C”(单精度复合体) |
任何 |
1 |
其值形式为“x+yj”的字符串 |
OFSTNone |
“C”(单精度复合体) |
任何 |
> 1 |
值的格式为“x+yj”的字符串列表 |
OFSTNone |
“M”(双精度复数) |
任何 |
1 |
其值形式为“x+yj”的字符串 |
OFSTNone |
“M”(双精度复数) |
任何 |
> 1 |
值的格式为“x+yj”的字符串列表 |
OFSTNone |
表示固定大小数组的重复计数大于1的字段,或使用可变长度数组的数组描述符“P”和“Q”的字段映射到OGR列表数据类型。这种场的潜在二维结构在OGR中没有直接的等价性,因此OGR将暴露一个线性结构。对于固定大小的数组,用户可以检索层元数据中TDIMxx头的值,以恢复字段的维度。
具有TSCAL和/或TZERO标头的字段将自动缩放并偏移到物理值(仅适用于数字数据类型)
TNULL头用于整数数字数据类型,并用于将OGR字段设置为NULL的单个出现字段。
图层创建选项
以下图层创建选项可用:
REPEAT_{fieldname}=number. For a given field (substitute {fieldname} by its name) of type IntegerList, Integer64List or RealList, specify a fixed number of elements. Otherwise those fields will be created as variable-length FITS columns, which can have performance impact on creation.
COMPUTE_REPEAT=AT_FIELD_CREATION/AT_FIRST_FEATURE_CREATION. For fields of type IntegerList, Integer64List or RealList, specifies when they are mapped to a FITS column type. The default is AT_FIELD_CREATION, and implies that they will be created as variable-length FITS columns, unless a REPEAT_{fieldname} option is specified. When AT_FIRST_FEATURE_CREATION is specified, the number of elements in the first feature will be taken into account to create fixed-size FITS columns.
使用ogr2ogr或 GDALVectorTranslate()
对于FITS源,将考虑FITS头,特别是帮助确定目标列的FITS数据类型。
实例
在MEF.fits中列出子数据集:
$ gdalinfo ../autotest/gdrivers/data/fits/image_in_first_and_second_hdu.fits Driver: FITS/Flexible Image Transport System Files: ../autotest/gdrivers/data/fits/image_in_first_and_second_hdu.fits Size is 512, 512 Metadata: EXTNAME=FIRST_IMAGE Subdatasets: SUBDATASET_1_NAME=FITS:"../autotest/gdrivers/data/fits/image_in_first_and_second_hdu.fits":1 SUBDATASET_1_DESC=HDU 1 (1x2, 1 band), FIRST_IMAGE SUBDATASET_2_NAME=FITS:"../autotest/gdrivers/data/fits/image_in_first_and_second_hdu.fits":2 SUBDATASET_2_DESC=HDU 2 (1x3, 1 band) Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0, 512.0) Upper Right ( 512.0, 0.0) Lower Right ( 512.0, 512.0) Center ( 256.0, 256.0)
打开给定的栅格HDU:
$ gdalinfo FITS:"../autotest/gdrivers/data/fits/image_in_first_and_second_hdu.fits":1 Driver: FITS/Flexible Image Transport System Files: none associated Size is 1, 2 Metadata: EXTNAME=FIRST_IMAGE Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0, 2.0) Upper Right ( 1.0, 0.0) Lower Right ( 1.0, 2.0) Center ( 0.5, 1.0) Band 1 Block=1x1 Type=Byte, ColorInterp=Undefined
列出FITS文件中的潜在二进制表:
$ ogrinfo my.fits
将地理包层转换为二进制表:
$ ogr2ogr out.fits my.gpkg my_table
其他
注:执行为 gdal/frmts/fits/fitsdataset.cpp
.
GDAL中CFITSIO连接的注意事项
Linux系统
来源
从发行版安装CFITSIO头文件(例如,Fedora上的CFITSIO devel;Debian Ubuntu上的libcfitsio dev),然后像往常一样编译GDAL。CFITSIO将被自动检测和链接。
从发行版
在Fedora/CentOS上安装CFITSIO,然后GDAL与dnf(yum):CFITSIO自动链接。
麦克索克斯
MacOSX包的最新版本没有与CFITSIO链接。按照中的说明安装CFITSIO official documentation .
驱动程序功能
Supports CreateCopy()
This driver supports the GDALDriver::CreateCopy()
operation
Supports Create()
This driver supports the GDALDriver::Create()
operation
Supports Georeferencing
This driver supports georeferencing
Supports VirtualIO
This driver supports virtual I/O operations (/vsimem/, etc.)