[Shake-dev] ShakeMap v3.2 grind question

Vince Quitoriano vinceq at usgs.gov
Mon Apr 7 21:59:07 MST 2008


Ah, interesting. It's the GMT header padding problem, which I thought
was fixed for GMT 4.1. From the file perl/lib/Shake/GMThd.pm:

# The people that designed this header apparently didn't know anything
# about data alignment.  On a RISC machine, the C compilier adds an extra
# 4 byte quantity following 'node_offset' to maintain double alignment in
# the structure.   This will, of course, be different on different machines,
# and proper structure design would have greatly reduced this misalignment,
# but no....
# So we add 4 bytes to the read, and insert a dummy in the
# unpack in new(), below, for machines with RISC architecture.
#
# They seem to have figured this out in V4.1+ of GMT.  Those versions
# now write the first three values and then the rest of the header.
# So for those versions, the CISC and RISC versions are the same.  But
# for pre 4.1 versions, we still need to accomodate the padding on
# RISC machines.

If you have GMT 4.1 and this is still a problem, we need to document it.

Now if you look at your file lib/ShakeConfig.pm there will be 2 lines
you need to edit:

$architecture = 'CISC';

and

$GMTversion = 'POST_4_1';

Let me know if this works.

- Vince

Dong-Hoon Sheen wrote:
> The result shows that:
> 
>    432,373
> 
> I modifed grind :
> 
>     my $check = read(READER, $buf, $nx * $ny * $fltsz);
>     print "$nx,$ny,$fltsz,$check\n"; exit;
> 
> which shows that
> 
>     432,373,4,644540
> 
> Dong-Hoon Sheen
> 
> ----- Original Message ----- 
> From: "Vince Quitoriano" <vinceq at usgs.gov>
> To: "Dong-Hoon Sheen" <dhsheen at kigam.re.kr>
> Sent: Tuesday, April 08, 2008 11:56 AM
> Subject: Re: [Shake-dev] ShakeMap v3.2 grind question
> 
> 
>>
>> Dong-Hoon Sheen wrote:
>>> The filesize is 645436 which is 432*373*4+892.
>>>
>>> Thanks.
>>>
>>> Dong-Hoon.
>> Hmm, there might be something wrong with the header.
>> Could you take out the 'test.grd' and add this line to grind:
>>
>>    my $nx = $ghd->nx();
>>    my $ny = $ghd->ny();
>>    print "$nx,$ny\n"; exit;
>>
>> Let's see if the header is being read correctly.
>>
>> - Vince
>>
>>
>>>
>>> ----- Original Message ----- 
>>> From: "Vince Quitoriano" <vinceq at usgs.gov>
>>> To: "Dong-Hoon Sheen" <dhsheen at kigam.re.kr>
>>> Sent: Tuesday, April 08, 2008 10:18 AM
>>> Subject: Re: [Shake-dev] ShakeMap v3.2 grind question
>>>
>>>
>>>> What is the filesize?
>>>>
>>>> - Vince
>>>>
>>>> Dong-Hoon Sheen wrote:
>>>>>  
>>>>> Hi,
>>>>> I got the grid file by following you, but it seems to be ok.
>>>>>  
>>>>>  > grdinfo test.grd
>>>>> test.grd: Title: surface
>>>>> test.grd: Command: /usr/local/GMT4.2.1/bin//surface 
>>>>> -R123.916667/131.100000/32.900000/39.100000 
>>>>> -I0.0166666666666667/0.0166666666666667 -Gtest.grd=1 -T0.9 -Ll0
>>>>> test.grd: Remark:
>>>>> test.grd: Normal node registration used
>>>>> test.grd: Grid file format: bf (# 1)
>>>>> test.grd: x_min: 123.917 x_max: 131.1 x_inc: 0.0166667 name: x nx: 432
>>>>> test.grd: y_min: 32.9 y_max: 39.1 y_inc: 0.0166667 name: y ny: 373
>>>>> test.grd: z_min: 0.00644428 z_max: 20.3478 name: z
>>>>> test.grd: scale_factor: 1 add_offset: 0
>>>>>  
>>>>> Thank you.
>>>>>  
>>>>> Dong-Hoon Sheen.
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> Shake-dev mailing list
>>>>> Shake-dev at geohazards.usgs.gov
>>>>> https://geohazards.usgs.gov/mailman/listinfo/shake-dev
>>


More information about the Shake-dev mailing list