Opened 4 years ago

Closed 4 years ago

#5431 closed enhancement (fixed)

[PATCH] Add support for two bytes data into the IRIS driver

Reported by: rveciana Owned by: warmerdam
Priority: normal Milestone: 1.11.0
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

I've improved the IRIS driver so it can read more product types. With the old version, some quite common products failed when opened, because the driver couldn't read its data type. I don't know if this case is an enhacement or a bug, since some files failed without the changes.

Attachments (1)

irisdataset.cpp (41.7 KB) - added by rveciana 4 years ago.
The file to be changed

Download all attachments as: .zip

Change History (6)

Changed 4 years ago by rveciana

Attachment: irisdataset.cpp added

The file to be changed

comment:1 Changed 4 years ago by Even Rouault

Summary: Add support for two bytes data into the IRIS driver[PATCH] Add support for two bytes data into the IRIS driver

Roger, I don't know which base version you've used (please always start from the trunk version !), but it looks like your version has reverted recent changes in the driver, namely that one : http://trac.osgeo.org/gdal/changeset/26065/trunk/gdal/frmts/iris that you asked in #5104

I suppose the real diff you want is ? :

Index: irisdataset.cpp
===================================================================
--- irisdataset.cpp	(revision 27110)
+++ irisdataset.cpp	(working copy)
@@ -229,9 +229,9 @@
     if( (int)VSIFReadL( pszRecord, nBlockXSize*nDataLength, 1, poGDS->fp ) != 1 )
         return CE_Failure;
     
-    //If datatype is dbZ:
-    //See point 3.3.5 at page 3.42 of the manual
-    if(poGDS->nDataTypeCode == 2){
+    //If datatype is dbZ or dBT:
+    //See point 3.3.3 at page 3.33 of the manual
+    if(poGDS->nDataTypeCode == 2 || poGDS->nDataTypeCode == 1){
         float fVal;
         for (i=0;i<nBlockXSize;i++){
             fVal = (((float) *(pszRecord+i*nDataLength)) -64)/2.0;
@@ -239,6 +239,16 @@
                 fVal = -9999;
             ((float *) pImage)[i] = fVal;
         }
+    //If datatype is dbZ2 or dBT2:
+    //See point 3.3.4 at page 3.33 of the manual
+    } else if(poGDS->nDataTypeCode == 8 || poGDS->nDataTypeCode == 9){
+        float fVal;
+        for (i=0;i<nBlockXSize;i++){
+            fVal = (((float) CPL_LSBUINT16PTR(pszRecord+i*nDataLength)) - 32768)/100.0;
+            if (fVal == 327.67)
+                fVal = -9999;
+            ((float *) pImage)[i] = fVal;
+        }
     //Fliquid2 (Rain1 & Rainn products)
     //See point 3.3.11 at page 3.43 of the manual
     } else if(poGDS->nDataTypeCode == 37){

comment:2 Changed 4 years ago by rveciana

Sorry, I missed the old change.

Yes, the diff I want is what you write here.

If datatype is dbZ2 or dBT2:

See point 3.3.4 at page 3.33 of the manual

} else if(poGDS->nDataTypeCode == 8
poGDS->nDataTypeCode == 9){

float fVal; for (i=0;i<nBlockXSize;i++){

fVal = (((float) CPL_LSBUINT16PTR(pszRecord+i*nDataLength)) - 32768)/100.0; if (fVal == 327.67)

fVal = -9999;

((float *) pImage)[i] = fVal;

}

comment:3 Changed 4 years ago by Even Rouault

Roger, you mention only the second part of the patch. What about the previous one ? :

+    //If datatype is dbZ or dBT:
+    //See point 3.3.3 at page 3.33 of the manual
+    if(poGDS->nDataTypeCode == 2 || poGDS->nDataTypeCode == 1){

comment:4 Changed 4 years ago by rveciana

Sorry again! Yes, this is also necessary to allow readint the daya type T.

comment:5 Changed 4 years ago by Even Rouault

Resolution: fixed
Status: newclosed

trunk r27141 "IRIS: add support for two bytes data (patch by Roger Veciana, #5431)"

Note: See TracTickets for help on using tickets.