From: <and...@us...> - 2009-08-18 09:52:42
|
Revision: 10279 http://plplot.svn.sourceforge.net/plplot/?rev=10279&view=rev Author: andrewross Date: 2009-08-18 09:52:30 +0000 (Tue, 18 Aug 2009) Log Message: ----------- Update f95 bindings and examples to include plarc, plbtime, plctime and plconfigtime. Modified Paths: -------------- trunk/bindings/f95/plstubs.h trunk/bindings/f95/scstubs.c trunk/examples/f95/x03f.f90 trunk/examples/f95/x29f.f90 Modified: trunk/bindings/f95/plstubs.h =================================================================== --- trunk/bindings/f95/plstubs.h 2009-08-18 09:07:19 UTC (rev 10278) +++ trunk/bindings/f95/plstubs.h 2009-08-18 09:52:30 UTC (rev 10279) @@ -167,11 +167,13 @@ #define PL_SETCONTLABELPARAMa FNAME(PL_SETCONTLABELPARAM_,pl_setcontlabelparam_) #define PLABORT7 FNAME(PLABORT7,plabort7) #define PLADV FNAME(PLADV,pladv) +#define PLARC FNAME(PLARC,plarc) #define PLAXES7 FNAME(PLAXES7,plaxes7) #define PLBIN FNAME(PLBINF77,plbinf77) #define PLBOP FNAME(PLBOP,plbop) #define PLBOX37 FNAME(PLBOX37,plbox37) #define PLBOX7 FNAME(PLBOX7,plbox7) +#define PLBTIME FNAME(PLBTIME,plbtime) #define PLCALC_WORLD FNAME(PLCALC_WORLD,plcalc_world) #define PLCALC_WORLDa FNAME(PLCALC_WORLD_,plcalc_world_) #define PLCLEAR FNAME(PLCLEAR,plclear) @@ -179,11 +181,13 @@ #define PLCOL FNAME(PLCOL,plcol) #define PLCOL0 FNAME(PLCOL0,plcol0) #define PLCOL1 FNAME(PLCOL1,plcol1) +#define PLCONFIGTIME FNAME(PLCONFIGTIME,plconfigtime) #define PLCON07 FNAME(PLCON07,plcon07) #define PLCON17 FNAME(PLCON17,plcon17) #define PLCON27 FNAME(PLCON27,plcon27) #define PLCONT7 FNAME(PLCONT7,plcont7) #define PLCPSTRM FNAME(PLCPSTRMF77,plcpstrmf77) +#define PLCTIME FNAME(PLCTIME,plctime) #define PLEND FNAME(PLEND,plend) #define PLEND1 FNAME(PLEND1,plend1) #define PLENV FNAME(PLENV,plenv) Modified: trunk/bindings/f95/scstubs.c =================================================================== --- trunk/bindings/f95/scstubs.c 2009-08-18 09:07:19 UTC (rev 10278) +++ trunk/bindings/f95/scstubs.c 2009-08-18 09:52:30 UTC (rev 10279) @@ -74,6 +74,12 @@ } void +PLARC(PLFLT *x, PLFLT *y, PLFLT *a, PLFLT *b, PLFLT *angle1, PLFLT *angle2, PLBOOL *fill) +{ + c_plarc(*x, *y, *a, *b, *angle1, *angle2, *fill); +} + +void PLAXES7(PLFLT *x0, PLFLT *y0, const char *xopt, PLFLT *xtick, PLINT *nxsub, const char *yopt, PLFLT *ytick, PLINT *nysub) { @@ -87,6 +93,12 @@ } void +PLBTIME(PLINT *year, PLINT *month, PLINT *day, PLINT *hour, PLINT *min, PLFLT *sec, PLFLT *ctime) +{ + c_plbtime(year, month, day, hour, min, sec, *ctime); +} + +void PLBOP(void) { c_plbop(); @@ -148,12 +160,24 @@ } void +PLCONFIGTIME(PLFLT *scale, PLFLT *offset1, PLFLT *offset2, PLINT *ccontrol, PLBOOL *ifbtime_offset, PLINT *year, PLINT *month, PLINT *day, PLINT *hour, PLINT *min, PLFLT *sec) +{ + c_plconfigtime(*scale, *offset1, *offset2, *ccontrol, *ifbtime_offset, *year, *month, *day, *hour, *min, *sec); +} + +void PLCPSTRM(PLINT *iplsr, PLBOOL *flags) { c_plcpstrm(*iplsr, *flags); } void +PLCTIME(PLINT *year, PLINT *month, PLINT *day, PLINT *hour, PLINT *min, PLFLT *sec, PLFLT *ctime) +{ + c_plctime(*year, *month, *day, *hour, *min, *sec, ctime); +} + +void PLEND(void) { c_plend(); @@ -270,7 +294,7 @@ } void -PLGDEV7(char *dev, int length ) +PLGDEV7(char *dev, int length) { c_plgdev(dev); } Modified: trunk/examples/f95/x03f.f90 =================================================================== --- trunk/examples/f95/x03f.f90 2009-08-18 09:07:19 UTC (rev 10278) +++ trunk/examples/f95/x03f.f90 2009-08-18 09:52:30 UTC (rev 10279) @@ -46,14 +46,10 @@ ! Set up viewport and window, but do not draw box call plenv(-1.3_plflt, 1.3_plflt, -1.3_plflt, 1.3_plflt, 1, -2) +! Draw circles for polar grid do i = 1,10 - do j = 0,360 - x(j) = 0.1_plflt*i*x0(j) - y(j) = 0.1_plflt*i*y0(j) - enddo -! Draw circles for polar grid - - call plline(x,y) + call plarc(0.0_plflt, 0.0_plflt, 0.1_plflt*i, 0.1_plflt*i, & + 0.0_plflt, 360.0_plflt, 0) enddo call plcol0(2) do i = 0,11 Modified: trunk/examples/f95/x29f.f90 =================================================================== --- trunk/examples/f95/x29f.f90 2009-08-18 09:07:19 UTC (rev 10278) +++ trunk/examples/f95/x29f.f90 2009-08-18 09:52:30 UTC (rev 10279) @@ -39,6 +39,7 @@ call plot1() call plot2() call plot3() + call plot4() call plend() end program x29f95 @@ -225,3 +226,144 @@ call plline(x(1:npts), y(1:npts)) end subroutine plot3 + +! +! +! + subroutine plot4() + use plplot, PI => PL_PI + implicit none + +! TAI-UTC (seconds) as a function of time. +! Use Besselian epochs as the continuous time interval just to prove +! this does not introduce any issues. + + real(kind=plflt) :: scale, offset1, offset2 + real(kind=plflt) :: xmin, xmax, ymin, ymax, xlabel_step + integer :: k, npts, i + logical :: if_TAI_time_format + character(len=10) :: time_format + character(len=100) :: title_suffix + character(len=100) :: xtitle + character(len=100) :: title + real(kind=plflt) :: x(1001), y(1001) + integer :: tai_year, tai_month, tai_day, tai_hour, tai_min; + real(kind=plflt) :: tai_sec, tai; + integer :: utc_year, utc_month, utc_day, utc_hour, utc_min; + real(kind=plflt) :: utc_sec, utc; + +! Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch +! B = 1900. + (JD -2415020.31352)/365.242198781 +! ==> (as calculated with aid of "bc -l" command) +! B = (MJD + 678940.364163900)/365.242198781 +! ==> +! MJD = B*365.24219878 - 678940.364163900 + scale = 365.242198781_plflt + offset1 = -678940.0_plflt + offset2 = -0.3641639_plflt + call plconfigtime(scale, offset1, offset2, z'0', 0, 0, 0, 0, 0, & + 0, 0._plflt) + + do k = 0,6 + if (k .eq. 0) then + call plctime(1950,0,2,0,0,0.,xmin) + call plctime(2020,0,2,0,0,0.,xmax) + npts = 70*12 + 1 + ymin = 0.0_plflt + ymax = 36.0_plflt + time_format="%Y%" + if_TAI_time_format = .true. + title_suffix = "from 1950 to 2020" + xtitle = "Year" + xlabel_step = 10.0_plflt + elseif ((k .eq. 1) .or. (k .eq. 2)) then + call plctime(1961,7,1,0,0,1.64757_plflt-.20_plflt, xmin) + call plctime(1961,7,1,0,0,1.64757_plflt+.20_plflt, xmax) + npts = 1001 + ymin = 1.625_plflt + ymax = 1.725_plflt + time_format = "%S%2%" + title_suffix = "near 1961-08-01 (TAI)" + xlabel_step = 0.05_plflt/(scale*86400.0_plflt) + if (k .eq. 1) then + if_TAI_time_format = .true. + xtitle = "Seconds (TAI)" + else + if_TAI_time_format = .false. + xtitle = "Seconds (TAI) labelled with corresponding UTC" + endif + elseif ((k .eq. 3) .or. (k .eq. 4)) then + call plctime(1963,10,1,0,0,2.6972788_plflt-.20_plflt, xmin) + call plctime(1963,10,1,0,0,2.6972788_plflt+.20_plflt, xmax) + npts = 1001 + ymin = 2.55_plflt + ymax = 2.75_plflt + time_format = "%S%2%" + title_suffix = "near 1963-11-01 (TAI)" + xlabel_step = 0.05_plflt/(scale*86400.0_plflt) + if (k .eq. 3) then + if_TAI_time_format = .true. + xtitle = "Seconds (TAI)" + else + if_TAI_time_format = .false. + xtitle = "Seconds (TAI) labelled with corresponding UTC" + endif + elseif ((k .eq. 5) .or. (k .eq. 6)) then + call plctime(2009,0,1,0,0,34._plflt-5._plflt,xmin) + call plctime(2009,0,1,0,0,34._plflt+5._plflt,xmax) + npts = 1001 + ymin = 32.5_plflt + ymax = 34.5_plflt + time_format = "%S%2%" + title_suffix = "near 2009-01-01 (TAI)" + xlabel_step = 1._plflt/(scale*86400._plflt) + if (k .eq. 5) then + if_TAI_time_format = .true. + xtitle = "Seconds (TAI)" + else + if_TAI_time_format = .false. + xtitle = "Seconds (TAI) labelled with corresponding UTC" + endif + endif + + do i=0,npts-1 + x(i+1) = xmin + i*(xmax-xmin)/(dble(npts-1)) + call plconfigtime(scale, offset1, offset2, z'0', 0, 0, 0, 0, & + 0, 0, 0._plflt) + tai = x(i+1); + call plbtime(tai_year, tai_month, tai_day, tai_hour, & + tai_min, tai_sec, tai) + call plconfigtime(scale, offset1, offset2, z'2', 0, 0, 0, & + 0, 0, 0, 0._plflt) + call plbtime(utc_year, utc_month, utc_day, utc_hour, & + utc_min, utc_sec, tai) + call plconfigtime(scale, offset1, offset2, z'0', 0, 0, 0, & + 0, 0, 0, 0._plflt) + call plctime(utc_year, utc_month, utc_day, utc_hour, & + utc_min, utc_sec, utc) + y(i+1)=(tai-utc)*scale*86400._plflt + enddo + + call pladv(0) + call plvsta() + call plwind(xmin, xmax, ymin, ymax) + call plcol0(1) + if (if_TAI_time_format) then + call plconfigtime(scale, offset1, offset2, z'0', 0, 0, 0, & + 0, 0, 0, 0._plflt) + else + call plconfigtime(scale, offset1, offset2, z'2', 0, 0, 0, & + 0, 0, 0, 0._plflt) + endif + call pltimefmt(time_format) + call plbox("bcnstd", xlabel_step, 0, "bcnstv", 0._plflt, 0) + call plcol0(3) + title = "@frPLplot Example 29 - TAI-UTC "// & + trim(title_suffix) + call pllab(xtitle, "TAI-UTC (sec)", title) + + call plcol0(4) + + call plline(x(1:npts), y(1:npts)) + enddo + end subroutine plot4 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |