Comments (12)
The solution to this would be something like this:
!c Do this early in the function
integer*2 b1, b2, b3, b4
...
!c Whenever you want to interpret 4 bytes as big endian int32
b1 = indata(40)
b2 = indata(39)
b3 = indata(38)
b4 = indata(37)
and then use these integer*2 variables in the iand statements.
This error is due to gfortran in gcc9 complying with the standards unlike earlier versions which were lax.
from isce2.
FYI: I just noticed that the multiplication signs are mostly missing. Looks like the blog is interpreting them as formatting characters. There should be a multiplication "asterisk" before each of the 256s.
Thank you. The lines I removed and added are below.
integer*4 b1, b2, b3, b4 !iyear=iand(indata(40),255)256256*256+iand(indata(39),255)256256+iand(indata(38),255)256+iand(indata(37),255) !idoy=iand(indata(44),255)256256256+iand(indata(43),255)256256+iand(indata(42),255)256+iand(indata(41),255)
!ims=iand(indata(48),255)256256256+iand(indata(47),255)256256+iand(indata(46),255)256+iand(indata(45),255)
b1 = indata(40)
b2 = indata(39)
b3 = indata(38)
b4 = indata(37)
iyear=iand(b1,255)256256256+iand(b2,255)256256+iand(b3,255)256+iand(b4,255)
b1 = indata(44)
b2 = indata(43)
b3 = indata(42)
b4 = indata(41)
idoy=iand(b1,255)256256256+iand(b2,255)256256+iand(b3,255)256+iand(b4,255)
b1 = indata(48)
b2 = indata(47)
b3 = indata(46)
b4 = indata(45)
ims=iand(b1,255)256256256+iand(b2,255)256256+iand(b3,255)*256+iand(b4,255)
from isce2.
Could you issue a Pull Request with these changes?
from isce2.
from isce2.
I'm far from a fortran expert but would it be more correct to use a _1
suffix to specify that the literals are integer*1
s? Changing each 255
to 255_1
fixes the issue for me (using macports gfortran-mp-9
)
from isce2.
rtburns has the best suggestion. It is cleaner and has the smallest change.
from isce2.
Great, I'll submit a PR then
from isce2.
test.f90:9:40:
print *, check, iand(check,255_1)
1
Error: Integer too big for its kind at (1). This check can be disabled with the option -fno-range-check
Would be a little cautious. Here is a test program to confirm:
program testbits
integer*1 check
integer i
integer*1 allbits
integer*2 shortcopy
allbits = -1
do i=-128, 127
check = i
shortcopy = i
print *, check, iand(check,allbits),iand(shortcopy,255)
end do
end program
Changing allbits to 255_1 still results in negative numbers.
from isce2.
Hmm. And unsigned ints don't appear to be standard in fortran.
What do the iands achieve here? If indata is already type integer*1 are they even needed?
from isce2.
My question also: The iands mask off the sign bit extended from the 8 bit value. since it needs to be treated as unsigned? I do recall that unsigned bytes were always a difficulty with Fortran.
Note that I had to change I*2 to I*4 in the initial fix I posted.
from isce2.
the problem is that fortran doesnt support unsigned ints. The information is read in as a byte stream (integer1 which is signed) and then converted to 4byte unsigned ints representing time tags. The iand converts values to unsigned equivalents. 255 cannot be stored in an integer1. An integer*2 can store the result of an iand operation.
from isce2.
How about just making the byte mask -1_1
?
Edit: nevermind, looks like you can't assume twos-complement in fortran
from isce2.
Related Issues (20)
- stackSentinel.py Segmentation fault (core dumped) HOT 1
- Bug when using unwrap2stage in topsApp.py
- cmake install issue HOT 2
- Ion parameter file
- make_single_reference_isce; how to set the value of range_looks and azimuth_looks
- run_07_pairs_misreg - Segmentation fault (core dumped) HOT 2
- how to move stack to another path or drive HOT 3
- Issue in Stamps Step (1,1) HOT 3
- IndexError in Offset.py HOT 9
- How to use stackStripMap.py to process a stack of TerraSAR-X images HOT 1
- Inconsistency in the format of the parameter "-b/--bbox"
- fetchOrbit.py Error to download POD HOT 1
- alosStack create_cmds error : startingswath HOT 1
- alosStack estimated interferogram coherence larger than 1 HOT 1
- How can change coherence chip dimention
- topsApp.py error HOT 2
- encounter buffer overflow problem when extracting ALOS level-1 data from alaska archive
- Short question - Masking interferograms before unwrapping
- Including brief description for downloading Sentienl-1 SLC data in topsStack documentation. HOT 1
- An import error when using the function of estCpxCoherence
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from isce2.