trajmean adding altitude AGL and MSL ?

Post any defects you find in the HYSPLIT software here. The HYSPLIT Developers carefully monitor this list and will work diligently to repair any reported problems. When posting a bug report, please specify both the HYSPLIT version and operating system you are using.
Post Reply
hbarbosa
Posts: 7
Joined: May 18th, 2015, 3:55 pm
Registered HYSPLIT User: No

trajmean adding altitude AGL and MSL ?

Post by hbarbosa » September 21st, 2017, 10:00 pm

Dear All,

I ran many simulation starting at the same lat/lon and altitude above ground but separated in steps of 1h, for all hours in a particular month.

I then modified the script run/testing/xcluster_example.scr to do a cluster analysis. One of the modifications I did was to change -v4 to -v1 for the plottraj program because I wanted the lower panel with the altitude profile along the trajectories.

The site is not allowing me to attach a PDF file, so I placed the PDF with all figures here:

http://www.fap.if.usp.br/~hbarbosa/cluster.pd

The plots for each cluster (drawn in black) starts at the correct AGL altitude (100m), however, the plot of the cluster (last page, in color) starts at a complete wrong altitude.

Looking at the output carefully, and at the code, what I traced back is that run/exec/trajmean is adding the AGL altitude column (the one just after longitude) with the TERR_MSL.

Is this the expected behaviour? why?
Is there an option to trajmean avoid doing that?

Henrique


More information:

Running on a SGI cluster, with linux SLES11
Hysplit4 downloaded in July 2015
Input is GDAS 0.5 degrees

TRAJ.CFG======
&SETUP
tratio = 0.75,
delt = 0.0,
mgmin = 10,
khmax = 9999,
kmixd = 0,
kmsl = 0,
kagl = 1,
k10m = 1,
nstr = 0,
mhrs = 9999,
nver = 0,
tout = 60,
tm_pres = 1,
tm_tpot = 1,
tm_tamb = 1,
tm_rain = 1,
tm_mixd = 1,
tm_relh = 1,
tm_sphu = 0,
tm_mixr = 0,
tm_dswf = 1,
tm_terr = 1,
dxf = 1.00,
dyf = 1.00,
dzf = 0.01,
messg = 'MESSAGE',
/

SETUP======
&SETUP
TM_PRES=1,
TM_TPOT=1,
TM_TAMB=1,
TM_RAIN=1,
TM_MIXD=1,
TM_TERR=1,
TM_DSWF=1,
TM_RELH=1,
TOUT=60,
/

ASCDATA.CFG======
-90.0 -180.0 lat/lon of lower left corner
0.5 0.5 lat/lon spacing in degrees
360 720 lat/lon number of data points
2 default land use category
0.2 default roughness length (m)
'../bdyfiles0p5/' directory of files

CONTROL=====
14 01 01 00 30
6
-3.212972 -60.598056 100
-3.139200 -60.131530 100
-3.097220 -59.986700 100
-2.890476 -59.969899 100
-2.594580 -60.209300 100
-2.144111 -58.999861 100
-336
0
10000.0
17
/work/hbarbosa/gdas0p5/
20140102_gdas0p5
/work/hbarbosa/gdas0p5/
20140101_gdas0p5
/work/hbarbosa/gdas0p5/
20131231_gdas0p5
/work/hbarbosa/gdas0p5/
20131230_gdas0p5
/work/hbarbosa/gdas0p5/
20131229_gdas0p5
/work/hbarbosa/gdas0p5/
20131228_gdas0p5
/work/hbarbosa/gdas0p5/
20131227_gdas0p5
/work/hbarbosa/gdas0p5/
20131226_gdas0p5
/work/hbarbosa/gdas0p5/
20131225_gdas0p5
/work/hbarbosa/gdas0p5/
20131224_gdas0p5
/work/hbarbosa/gdas0p5/
20131223_gdas0p5
/work/hbarbosa/gdas0p5/
20131222_gdas0p5
/work/hbarbosa/gdas0p5/
20131221_gdas0p5
/work/hbarbosa/gdas0p5/
20131220_gdas0p5
/work/hbarbosa/gdas0p5/
20131219_gdas0p5
/work/hbarbosa/gdas0p5/
20131218_gdas0p5
/work/hbarbosa/gdas0p5/
20131217_gdas0p5
/home/hbarbosa/hysplit/goam0p5/backward/
t140101_0030_backward.dat

barbara.stunder
Posts: 300
Joined: November 9th, 2012, 4:23 pm
Registered HYSPLIT User: Yes

Re: trajmean adding altitude AGL and MSL ?

Post by barbara.stunder » September 22nd, 2017, 11:18 am

You are trying something we have never done. The trajectory cluster program does not include the trajectory height in the cluster computation so that is why the -v4 option is used for the cluster means. Notice in the cluster mean tdump files (e.g. C2_4mean.tdump, the pressure and TERR_MSL are all zeros, though there is a mean height. The tdump with the cluster means (e.g. Cmean1_4.tdump, does not have pressure or TERR_MSL.

hbarbosa
Posts: 7
Joined: May 18th, 2015, 3:55 pm
Registered HYSPLIT User: No

Re: trajmean adding altitude AGL and MSL ?

Post by hbarbosa » September 22nd, 2017, 8:15 pm

Dear Barbara,

Indeed, the cluster tdump files don't have the extra columns. They include all trajs in the same file (for that cluster), but only the first 12 columns (the last three are lat, lon, and altitude AGL). That altitude is the same as in the original tdump files for each individual trajectory that end up into that cluster.

For the cluster mean files, on the other hand, the column which should be altitude AGL is actually the sum of AGL and TERR_MSL. That is my problem. The column #12, which should be just altitude AGL, has become AGL + TERR_MSL in the output of trajmean.

Is this a bug?

Henrique

hbarbosa
Posts: 7
Joined: May 18th, 2015, 3:55 pm
Registered HYSPLIT User: No

Re: trajmean adding altitude AGL and MSL ?

Post by hbarbosa » September 22nd, 2017, 9:04 pm

Dear Barbara,

I managed to modify the code to get the behavior that better suites my application (i.e. output of cluster mean trajectory in AGL instead of ASL). I had to change trajmean.c in two points only, very simple changes in indeed. Because I think this might be interesting to other users, I am sending my modifications below in case you want to implement them. In that case, it would be better to have an optional flag at the command line to control that.

Best,
Henrique

trajmean.c
ELSE
IF(NFILE.GT.1)WRITE(*,*)'Processing: ',FNAME(LFILE)(1:40)
END IF

! save endpts for trajectory LFILE for sum below
IP=1
! convert to grid
CALL CLL2XY(PARMAP,OLAT(IP),OLON(IP),XP(0,LFILE),YP(0,LFILE))
!write(*,*)'origin xp,yp:',XP(0,LFILE),YP(0,LFILE)
SHGT(0,LFILE)=OLVL(IP)-OTER(IP)!hmjb

DO KP=1,NP(IP,2)
! convert to grid
CALL CLL2XY(PARMAP,TLAT(KP,IP),TLON(KP,IP),XP(KP,LFILE),YP(KP,LFILE))
!write(*,*)'kp,lat,lon,xp,yp:',kp,TLAT(KP,IP),TLON(KP,IP),XP(KP,LFILE),YP(KP,LFILE)
SHGT(KP,LFILE)=THGT(KP,IP)-TERR(KP,IP) !hmjb
END DO

ELSE
WRITE(*,*)'File not found:',FNAME(LFILE)
END IF
(...)

DO LFILE=1,NFILE
IF(.NOT.(YP(KP,LFILE).EQ.0.0.AND.XP(KP,LFILE).EQ.0.0))THEN
N=N+1
SUMA=SUMA+YP(KP,LFILE)
SUMO=SUMO+XP(KP,LFILE)
!write(*,*)'kp,lfile,yp,xp,suma,sumo:',kp,lfile,YP(KP,LFILE),XP(KP,LFILE),suma,sumo
SUMH=SUMH+SHGT(KP,LFILE)
END IF
END DO

YPM(KP)=SUMA/FLOAT(N)
XPM(KP)=SUMO/FLOAT(N)
AHGT(KP)=SUMH/FLOAT(N) !hmjb

barbara.stunder
Posts: 300
Joined: November 9th, 2012, 4:23 pm
Registered HYSPLIT User: Yes

Re: trajmean adding altitude AGL and MSL ?

Post by barbara.stunder » September 26th, 2017, 10:30 am

Thank you very much for sending these changes. I will review them and consider adding them into our version.

Post Reply