I have a routine to figure out the time when a location last becomes
free of grounded ice (ie for comparing model results to data for the
last glacial cycle Antarctic ice sheet). To figure out whether the ice
is floating, we need to use mode INTERP. However, this ends up messing
up the @EVNT algorithm for finding out when the last crossing (in this
case ungrounding of ice) occurs., ie: in the below, with mode interp
on, mask_grounded (= if H*rhoI/rhoO gt Hw then 1 else 0) ends up with
fractional values.
set region/x=143.14 /y=-66.48
! H and Hw are 2D space + 1D time fields
LET rhoI = 910 ![kg/m3]
LET rhoO = 1028 ![kg/m3]
LET mask_grounded = if H*rhoI/rhoO gt Hw then 1 else 0
LET grounded_event=mask_grounded[T=-120:0@EVNT:1] ! find all the
instances when ice grounded (this starts at -120, incrementing
for each event)
LET last_event = grounded_event[T=@max] ! find the
value of the last event
LET mask_last = IF grounded_event EQ last_event THEN 1 ! make a mask
based on last event value, ie domain with event value = last value
LET idx= mask_last[T=@LOC:1] ! get the index
of the first value in the mask \ie the last grounded event
LET out = idx + 0.05 ! the 0.05 is to adjust the idx to output the
time between grounded and floating
Now we can work around this by setting mode INTERP, saving the
timeseries for each site, CAN DATA/ALL, can var/all, opening the saved
timeseries and then doing the above masking operation. But for our
large datasets, this
becomes awkward/slow. Anyway around this?
To be concrete, with the above work around for one data site and
model, I get out= -31.75
without the work around I get out=-119.9 with CAN MODE INTERP and
-70.57 with SET MODE INTERP
Cheers,
Lev
Lev Tarasov - Dept of Physics and Physical Oceanography,
Memorial University of Newfoundland.
email: lev@xxxxxx
http://www.physics.mun.ca/~lev/
Sabbatical Tel (519)-821-3555
Fax (709)-864-8739
This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php