Brian Curtis
From Projects
Contents |
[edit] 1 Research
[edit] 1.1 CCMC Run Analysis
- Search for all of my runs HERE
- Type "Brian_Curtis" in the field given
[edit] 1.1.1 Model Analysis
[edit] 1.1.2 Runs
OpenGGCM:
| Run # | Date Ran | Runtime | Bx,By,Bz | Vx,Vy,Vz | N | T | Bz shift time | Info |
|---|---|---|---|---|---|---|---|---|
| 1 | 08-06-2008 #1 | 3 Hours | 0,1,5 | -360,-28,-38 | 7 | 40000 | 1:00 | Images/Notes |
| 2 | 08-15-2008 #1 | 3 Hours | 0,1,5 | -360,-28,-38 | 7 | 40000 | 1:30 | Images/Notes |
| 3 | 08-15-2008 #2 | 6 Hours | 0,1,5 | -360,-28,-38 | 7 | 40000 | 4:00 | Images/Notes |
| 4 | 09-03-2008 #1 | 6 Hours | 0,1,5 | -360,-28,-38 | 3 | 40000 | 4:00 | Images/Notes |
| 5 | 10-06-2008 #1 | 6 Hours | 0,0,5 | -360,-28,-38 | 7 | 40000 | 2:00 | Images/Notes |
| 6 | 10-06-2008 #2 | 6 Hours | 0,0,5 | -360,-28,-38 | 3 | 40000 | 2:00 | Images/Notes |
| 7 | 10-15-2008 #1 | 6 Hours | 0,0,5 | -360,0,0 | 7 | 40000 | 2:00 | Images/Notes |
| 8 | 10-15-2008 #2 | 6 Hours | 0,0,5 | -360,0,0 | 3 | 40000 | 2:00 | Images/Notes |
| 9 | 01-05-2009 #1 | 6 Hours | 0,0,5 | -360,0,0 | 7 | 40000 | 2:00 | Images/Notes |
| 10 | 01-05-2008 #2 | 6 Hours | 0,0,5 | -360,0,0 | 3 | 40000 | 2:00 | Images/Notes |
| 11 | 05-21-2009 #1 | 6 Hours | 0,0,5 | -360,0,0 | 3 | 40000 | 4:00 | Images/Notes |
BATSRUS:
| Run # | Date Ran | Runtime | Bx,By,Bz | Vx,Vy,Vz | N | T | Bz shift time | Info |
|---|---|---|---|---|---|---|---|---|
| 12 | 05-26-2009 #1 | 6 Hours | 0,0,5 | -360,0,0 | 3 | 40000 | 2:00 | Images/Notes |
| 13 | 05-26-2009 #2 | 6 Hours | 0,0,5 | -360,0,0 | 7 | 40000 | 2:00 | Images/Notes |
BASTRUS-RCM:
| Run # | Date Ran | Runtime | Bx,By,Bz | Vx,Vy,Vz | N | T | Bz shift time | Info |
|---|---|---|---|---|---|---|---|---|
| 14 | 05-26-2009 #3 | 6 Hours | 0,0,5 | -360,0,0 | 7 | 40000 | 2:00 | Images/Notes |
| 15 | 05-26-2009 #4 | 6 Hours | 0,0,5 | -360,0,0 | 3 | 40000 | 2:00 | Images/Notes |
[edit] 1.2 Space Weather Forecasting
[edit] 1.2.1 Motivation
Meteorology is far ahead of space weather forecasting, but there are plenty of reasons as to why. Meteorology has a very numerous amount of data points. The United States has a system of devices called ASOS (Automated Surface Observing Systems) spread all across the country. In space weather forecasting there is a necessity for warning companies (power grid, communications, air travel) from impending geomagnetic storms, but the data points come from satellites, and there are a very small amount relative to meteorology. Also there are data models that help assist meteorologists greatly in providing forecasts that are good enough to prepare companies and people for most weather phenomena. Although models exist for space weather phenomena, they just aren't to the quality/confidence needed for space weather forecasters to feel comfortable enough to make predictions that wrong and right greatly effect the companies that follow them. The goal of this research is to benefit space weather forecasting.
- Space Weather Prediction Center (SWPC)
- Mission Statement: Space Weather Prediction Center continually monitors and forecasts Earth's space environment; provides accurate, reliable, and useful solar-terrestrial information; conducts and leads research and development programs to understand the environment and to improve services; advises policy makers and planners; plays a leadership role in the space weather community; and fosters a space weather services industry. Space Weather Prediction Center is the Nation's official source of space weather alerts and warnings.
- Problems:
- http://www.swpc.noaa.gov/forecast_verification/Assets/ShortTermWarnings/K5Table.html
- Why do the values in the contingency table not match the values in the table below it?
- POD and FAR both approx 50%, meaning they aren't doing any better than a flip of a coin
- Bias being that they make less forecasts than there are events seems more costly than if they over warn by 5%?
- Does correct null have any importance to the users of the forecasts?
- CSI seems to show low values for rare events, and isn't a K5 a semi-rare event? Does this make CSI irrelevant?
- http://www.swpc.noaa.gov/forecast_verification/Assets/MagProbs/magProbMidRPSPlot.html
- http://www.swpc.noaa.gov/forecast_verification/Assets/MagProbs/magProbMidStackPlot.html
- http://www.swpc.noaa.gov/forecast_verification/Assets/MagProbs/magProbHighRPSPlot.html
- http://www.swpc.noaa.gov/forecast_verification/Assets/MagProbs/magProbHighStackPlot.html
- http://www.swpc.noaa.gov/forecast_verification/Assets/Ap/Ap3dPlot.html
- http://www.swpc.noaa.gov/forecast_verification/Assets/Ap/ApStackPlot.html
- http://www.swpc.noaa.gov/forecast_verification/Assets/Ap/ApSkillPlot.html
- This one makes no sense based on the other graphs
- http://www.swpc.noaa.gov/forecast_verification/Assets/MFlares/mRelPlot.html
- http://www.swpc.noaa.gov/forecast_verification/Assets/MFlares/mStackPlot1.html
- http://www.swpc.noaa.gov/forecast_verification/Assets/MFlares/mStackPlot2.html
- Bz (nT): The orientation of the Interplanetary Magnetic Field (IMF) in the Z direction, There are studies that show that a positive Bz with all other variables being sufficient for geomagnetic storms, will not cause a storm, while a Bz in the negative with all other variables being sufficient for geomagnetic storms will cause a geomagnetic storm (but not all the time).
- Vsw (Km/s): The velocity of the solar wind is typically around 300-400Km/s. Higher solar wind speeds signify the presence of an acceleration caused typically by Coronal Mass Ejections (CME).
- Density[N] (#/cm^3):
- Dst (nT):
[edit] 1.3 Topics
- Decision Theory
- Base Understanding of the thinking that goes behind the decision on whether a forecast is sound or not.
- Goal: Prepare a 20 minute presentation for Lake Effect Conference
- Base Understanding of the thinking that goes behind the decision on whether a forecast is sound or not.
- Space Weather Forecasting
[edit] 1.3.1 Directions to go
- Discussion 07-01-2008
- There are two ways that I can go with my interest in space weather forecasting
- Understanding the physics behind the processes which would start out with understanding the sun and making my way towards the earth (typically called the Sun to Earth connection)
- Approaching space weather forecasting in a more statistical manner. (i.e. When "this" happens what statistically happens "there" or "here" afterwards?
[edit] 1.3.2 The Start
***READ 2 PAPERS A DAY***
- Find lists of substorms
- Loook at Dst as a part of substorms
- Trends?
- Warning Signs?
- Loook at Dst as a part of substorms
- Find who forecasts aurorae and who does it
- Finland or Sweden?
[edit] 1.4 Articles
[edit] 1.4.1 Forecasting Aurorae and/or Geomagnetic Storms
- Solar wind time history contribution to the day-of-year variation in geomagnetic activity PDF
- Forecasting Auroral Electrojet Activity from Solar Wind Input with Neural Networks PDF
- Geomagnetic storms. Measurement and forecastingPDF
- November 2004 space weather events Real-time observations and forecastsPDF
- The Public's Changing Interpretation of the AuroraPDF
- Forecast of auroral activityPDF
- A Kp-based model of auroral boundariesPDF
- Ring current influence on auroral electrojet predictionsPDF
- A new technique for short-term forecast of auroral activityPDF
- Does the Electrical Power Industry Need Better Storm Warnings?
- Halloween Space Weather Storms of 2003PDF
- Evaluating Space Weather Forecasts of Geomagnetic Activity from a User PerspectivePDF
[edit] 1.4.2 Decision Theory
- Decision theory and the analysis of rare event space weather forecasts PDF
- WEIGEL ET AL.
- Articles referenced in this one:
- Thomson, 2000
- Mozer and Briggs, 2003 PDF
- Weigel et al., 2003/2004
- Bellanger et al., 2003
- Lindley, 1985 (Dr. Weigel bring in)
- Wilks, 2001 (Have Paper)
- Gavrishchaka and Ganguli, 2001
- Doswell et al., 1990 (Have Paper)
- Decision theory is an extremely imporatant theory to forecasters around the world. The Utility of a forecast means that the user wants the least loss and the most gain from the forecast that they have created. The paper mentions that in the past this prediction of maximum utility is created using a highly correlation based model, this meaning that the forecasters want their predicted values to be as close as possible to the real measured values. The author appears to argue that each model can not always be fit for every user, and that there is a need to create more user-relevant metrics for the models, in essence making sure that each user has a model that is optimized for their needs. This is where the author introduces a metric of evaluating the hits, misses and false alarms of each forecast.
- The Cassandra CriterionPDF
- Why is Weather Forecasting Still under a Cloud?PDF
- Matthews 1997
- The main debate of this paper seems to be science versus public perception, but Matthews ties in some probability statistics to help prove his point (Decision Theory). On one side, you have the UK Met offices giving ~80% reliable forecasts on average, and on the other side you have the average human that has to make a daily decision. There is a factor in the successful forecasting of weather phenomenon, in this paper its specifically forecasting rain, called the base rate in which ties the value of a forecast into the frequency of the phenomenon. Matthews compares the average daily rainfall in different sections of the UK noting that in regions receiving many days of rain per year the population will accept the forecast as there are many more "hits" than "misses", on the contrary, the regions in the UK that receive significantly less rain throughout the year, the population will take the forecasts less seriously. In his discussion and conclusions he notes that forecasts right now are ~80% accurate for daily forecasts, but given an hourly forecast is much more difficult which helps skew to the publics point of view on forecasts.
- Bayesian theory of probabilistic forecasting via deterministic hydrologic model PDF
- Why Should a Forecaster and a Decision Maker Use Bayes Theorem?PDF
- A Prediction and Decision Method for Applied Meteorology and Climatology, Based Partly on the Theory of GamesPDF
- Evaluating Space Weather Forecasts of Geomagnetic Activity from a User PerspectivePDF
- Thomson does a good job explaining the basics of space weather and the basics of forecasting. He mentions that the description of space weather today is "the current state of the space environment", and that the importance of space weather forecasting is for the private companies in the world that rely on the forecasts to help with decisions on when to take action on an impending geomagnetic storm. Sattelites, Space Exploration, Power Grids, Radio Communications are a few of the many things that are impacted by geomagnetic storms. Thomson introduces a few mathematical equations that when put together, will help the user gain understanding (and possibly calculate) the costs/benefits of his/her action based on a forecast of activity occuring/not occuring based on whether or not activity actually occurs. Thomson also made a small comparison between the loss structures (K) of meteorology and space weather. I felt an interesting point to this paper was the "cry wolf" understanding of the public. Meteorologists face this problem daily and it seems that space weather forecasters are in the same boat. The public will judge the forecast based on a "correct" or "incorrect" result, and not based on the parameters defined in this paper.
- ADS Library:http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?library&libname=Aurorae&libid=47b99c42b4
[edit] 2 Classes
[edit] 2.1 Fall 2007
- CSI 700: (3) Numerical Methods
- CSI 710: (3) Scientific Databases
- CSI 769: (3) Magnetospheric Physics
[edit] 2.2 Spring 2008
- CSI 701: (3) Foundations of Computational Sciences
- CSI 703: (3) Scientific Visualization
- CSI 796: (2) Directed Reading and Research
- CSI 991: (1) Space Sciences Seminar
[edit] 2.3 Fall 2008
- CSI 761: (3) N-Body Methods and Particle Simulations
- CSI 796: (2) Directed Reading and Research
- CSI 899: (1) Computational Sciences and Informatics Colloquium
- PHYS 305:(3) Electromagnetic Theory
[edit] 2.4 Spring 2009
- CSI 660: (3) Space Plasma Physics
- CSI 661: (3) Astrophysics
- CSI 769: (3) Directed Reading and Research
[edit] 2.5 Fall 2009
- CSI 662: (3) Space Weather
- CSI 789: (3) Classical Electrodynamics
- CSI 769: (2) Directed Reading and Research
- CSI 991/899: (1) Space Science Seminar/CSI Colloquium
[edit] 2.6 Spring 2010 (planned)
- CSI 763: (3) Statistical methods in Space Sciences
- CSI ???: (3) ???Parallelization Class???
[edit] 3 Projects
[edit] 3.1 Space Weather Forecast Contest
- http://swxcontest.gmu.edu
- ToDo:
- User Login Sessions
- Add a discussion on forecast metrics. Put a link to my derivation that PE ~= cc^2. Put a link to my paper on decision theory (Bob)
- Create a NASA/ADS library for metrics (Bob)
- From GEM:
- add contingency table to results (tooltip-like? (require javascript) Think of alternative measures of forecast quality...to be discussed on Friday. Brian)
- allow users to make all forecasts on one day and I thought you were not going to get me anything for my birthday.
- add CCMC real-time model run results to forecast prep page. Add prediction of Vx at L1, which may be at SWPC, and Kp, which may be posted at SWPC as well.
- add autoregressive forecast for Kp and Vx (Brian)
- Investigate submission to Space Weather (Bob)
- Add Virbo UI to website for historical data (periodicities)? Add the applet that allows you to browse time series. (Bob)
- Write code to make a user who registers before registration deadline is over automatically full time.. and after that date part time
- Done:
- Add all columns in the results page table to the dYYYYMMDD database table for long-term storage. The username and institution and cumulative scores don't show up if the users are deleted.
[edit] 3.2 Evaluation of Space Science Databases
- CSI 710, Fall 2007 Project http://aurora.gmu.edu/CSI710/index.php/Main_Page
- Image:CSI710 Project Final V3.ppt
[edit] 3.3 Magnetosphere Simulations
- CSI 769, Fall 2007 Project
- Page with simulation results Brian_Curtis_CSI769
[edit] 3.4 Matlab program to create CCMC SW input
% Creates constant input for all variables except Bz (GSM) for 180 minutes
% Bz (GSM) changes from +5 to -5 after 60 minutes.
% N=181 allows for the creation of the data point for start of the third hour
N=181;
yr=repmat(2000,N,1);
month=repmat(1,N,1);
day=repmat(1,N,1);
hr=[0:3];
hr=repmat(hr,60,1);
hr=hr(:);
mn=[0:59]';
mn=repmat(mn,4,1);
sec=repmat(0,N,1);
msec=repmat(0,N,1);
bxgsm=repmat(0,N,1);
bygsm=repmat(1,N,1);
% bzgsm is +5 for first 60 minutes than -5 for 120 minutes
% the 4th '-5' is so the program can write data into the file for hour 3
bzgsm=[5 -5 -5 -5];
bzgsm=repmat(bzgsm,60,1);
bzgsm=bzgsm(:);
vxgsm=repmat(-360,N,1);
vygsm=repmat(-28,N,1);
vzgsm=repmat(-38,N,1);
den=repmat(7,N,1);
temp=repmat(40000,N,1);
fid=fopen('sw.dat','wt');
for i=1:N
fprintf(fid,'%4d %3d %3d %3d %3d %3d %3d%10.5f%10.5f%10.5f%10.3f%10.3f%10.3f%10.3f%14.2f\n',yr(i),month(i),day(i),hr(i),mn(i),sec(i),msec(i),bxgsm(i),bygsm(i),bzgsm(i),vxgsm(i),vygsm(i),vzgsm(i),den(i),temp(i));
end
fclose(fid);
[edit] 3.5 Octave Mediawiki
Call Octave from Mediawiki
[edit] 3.6 File Formats
- Purpose of Task
- Evaluate performance of file formats for data mining time series
- Research
- 1. See http://developers.slashdot.org/article.pl?sid=07/09/06/1527258
- 1*. Put summary of HDF, CDF, NetCDF here. What are their differences? How are they similar? What advantage does one provide over the other?
- 2. See http://hdfgroup.com/HDF5/RD100-2002/HDF5_Performance.pdf
- 3. See http://www.hdfeos.org/workshops/ws05/presentations/Pourmal/05-2c-HDF5_Performance.ppt
- 4. How does CDF compare?
- 5. Weigel's Matlab CDF reader experience.
- Vendors do dumb things and create terrible implementations of scientific file format readers
- Recent Matlab releases will use HDF5 as one of their "native" file formats
- HDF5 and netCDF are merging (merged?) html, and differences between HDF5 and CDF link.
- Does HDF5 allow random access to compressed data?
- So much data is time on a uniform time grid. CDF is a complex format - it seems to heavy-duty at times for just simple time series. Is there a CDFlite that is easier to implement and less difficult for vendors to screw up?
[edit] 3.6.1 HDF
- HDF = Hierarchical Data Format
- HDF5 is a unique technology suite that makes possible the management of extremely large and complex data collections.
- The HDF5 technology suite includes:
- A versatile data model that can represent very complex data objects and a wide variety of metadata.
- A completely portable file format with no limit on the number or size of data objects in the collection.
- A software library that runs on a range of computational platforms, from laptops to massively parallel systems, and implements a high-level API with C, C++, Fortran 90, and Java interfaces.
- A rich set of integrated performance features that allow for access time and storage space optimizations.
- Tools and applications for managing, manipulating, viewing, and analyzing the data in the collection.
- HDF5 and HDF4 are quite different where many operational codes in HDF4 will not work in HDF5 and vice versa.
- HDF the god of all DF's ?
[edit] 3.6.2 CDF
- CDF = Common Data Format
- Restrictions
- The multi-file format has the following restrictions:
- Compression: Compression is not allowed for the CDF or any of its variables.
- Sparseness: Sparse records or arrays for variables are not allowed.
- Allocation: Pre-allocation of records or blocks of records is not allowed. For each variable, the maximum written record is the last allocated record.
- Deletion: Deletion of a single variable from a CDF is not allowed. Only deleting a whole CDF is possible.
[edit] 3.6.3 netCDF
- netCDF = Network Common Data Format
- The data format is "self-describing". This means that there is a header which describes the layout of the rest of the file
- [3]NetCDF (network Common Data Form) is a set of software libraries and machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data.
- [4]NetCDF data is:
- Self-Describing. A netCDF file includes information about the data it contains.
- Portable. A netCDF file can be accessed by computers with different ways of storing integers, characters, and floating-point numbers.
- Direct-access. A small subset of a large dataset may be accessed efficiently, without first reading through all the preceding data.
- Appendable. Data may be appended to a properly structured netCDF file without copying the dataset or redefining its structure.
- Sharable. One writer and multiple readers may simultaneously access the same netCDF file.
- Archivable. Access to all earlier forms of netCDF data will be supported by current and future versions of the software.
[edit] 3.6.4 COMPARISONS
[edit] 3.6.4.1 CDF vs. netCDF
- CDF was designed and developed in 1985 by the National Space Science Data Center (NSSDC) at NASA/GSFC. CDF was originally written in FORTRAN and only available on the VAX/VMS environments. NetCDF was developed a few years later by the National Center for Atmospheric Research (NCAR). The netCDF model was based on that of the CDF conceptual model but provided a number of additional features (such as C language bindings, portable to a number of platforms, machine-independent data format, etc.). Today both models and existing software have matured substantially since and are quite similar in most respects, although they do differ in the following ways:
- Although the interfaces do provide the same basic functionality they do differ syntactically. (See users guides for details.)
- NetCDF supports named dimensions (i.e., TEMP[x, y, ...]) whereas CDF utilizes the traditional logical (i.e., TEMP[true, true, ...]) method of indicating dimensionality.
- CDF supports both multi- and single file filing systems whereas netCDF supports only single file filing systems.
- CDF software can transparently access data files in any encoding currently supported by the CDF library (For example: a CDF application running on a Sun can read and write data encoded in a VAX format.) in addition to the machine-independent (XDR) encoding. netCDF software reads and writes data in only the XDR data encoding.
- The CDF library supports an internal caching algorithm in which the user can make modifications (if so desired) to tweak performance.
- The netCDF data object is currently accessible via the HDF software; CDF is not.
- As part of the CDF distribution, there exist a number of easy-to-use tools and utilities that enable the user to edit, browse, list, prototype, subset, export to ASCII, compare, etc. the contents of CDF data files.
- [6]NetCDF users will be able to create HDF5 files with benefits not available with the netCDF format, such as much larger files and multiple unlimited dimensions.
[edit] 3.6.4.2 CDF vs. HDF4
- CDF is a scientific data management software package and format based on a multidimensional (array) model. HDF is a Hierarchal Data Format developed at the National Center for Supercomputing Applications (NCSA) at the University of Illinois. The HDF4 data model is based on the hierarchical relationship and dependencies among data. Although the two models differ (in many ways like comparing apples to oranges) significantly in their level of abstraction and the way in which their inherent structures are defined and accessed, there exists a large overlap in the types of scientific data that each can support. Some of the obvious differences are as follows:
- The HDF4 structure is based on a tagged format, storing tag identifiers (i.e., utility, raster image, scientific data set, and Vgroup/Vdata tags) for each inherent data object. The basic structure of HDF consists of an index with the tags of the objects in the file, pointers to the data associated with the tags, and the data themselves. The CDF structure is based on variable definitions (name, data type, number of dimensions, sizes, etc.) where a collection of data elements is defined in terms of a variable. The structure of CDF allows one to define an unlimited number of variables completely independent (loosely coupled) of one another and disparate in nature, a group of variables that illustrate a strong dependency (tightly coupled) on one another or both simultaneously. In addition CDF supports extensive metadata capabilities (called attributes), which enable the user to define further the contents of a CDF file.
- HDF4 supports a set of interface routines for each supported object (Raster Image, Pallets, Scientific Data Sets, Annotation, Vset, and Vgroup) type. CDF supports two interfaces from which a CDF file can be accessed: the Internal Interface and the Standard Interface. The Internal Interface is very robust and consists of one variable argument subroutine call that enables a user to utilize all the functionality supported via CDF software. The Standard Interface is built on top of the Internal Interface and consists of 23 subroutine calls with a fixed argument list. The Standard Interface provides a mechanism in which novice programmers can quickly and easily create a CDF data file.
- HDF4 currently offers some compression for storing certain types of data objects, such as images. CDF supports compression of any data type with a choice of run-length encoding, Huffman, adaptive Huffman, and Gnu's ZIP algorithms.
- CDF supports an internal cache in which the user can modify the size through the Internal Interface to enhance performance on specific machines.
- HDF4 data files are difficult to update. Data records are physically stored in a contiguous fashion. Therefore, if a data record needs to be extended it usually means that the entire file has to be rewritten. CDF maintains an internal directory of pointers for all the variables in a CDF file and does not require all the data elements for a given variable to be contiguous. Therefore, existing variables can be extended, modified, and deleted, and new variables added to the existing file.
- In the late 1980's the CDF software was redesigned and rewritten (CDF 2.0) in C. With little or no impact on performance, the redesign provided for an open framework that could be easily extended to incorporate new functionality and features when needed. CDF is currently at Version 3.0, and performance has been enhanced significantly.
- CDF supports both host encoding and the machine-independent (XDR) encoding. In addition, the CDF software can transparently access data files in any encoding currently supported by the CDF library (For example, a CDF application running on a Sun can read and write data encoded in a VAX format.) HDF4 supports both host encoding and the machine-independent (XDR) encoding.
[edit] 3.6.4.3 CDF vs. HDF5
- CDF is a scientific data management software package and format based on a multidimensional (array) model. HDF is a Hierarchal Data Format developed at the National Center for Supercomputing Applications (NCSA) at the University of Illinois. The data model of CDF is very similar to HDF5's data model. They both have 2 basic objects: data and attribute. Data is an entity that represents data while attribute is a mechanism used to denote data. HDF5 allows to group similar objects into a group, but CDF doesn't have a grouping mechnism.
- Albeit HDF4 and HDF5 are developed by the same organization, the data model of HDF5 is totally different from HDF4 and their formats are incompatible.
[edit] 3.7 PHP demo
- A PHP script that will allows the user to insert information about data they would like to look at, then send them to a separate html page that will supply a link to download the data they requested from the server.
- Proceedure
- 1. I decided that in order to make it easy for the user to input the necessary information for the data retrieval that I would create an HTML form.
- This HTML form will input the information into the URL to be accessed by the php script.
<HTML> <BODY> <FORM action="phptask.php" method="get"> WHAT DATABASE?<INPUT name="database" type="text" /><br> START(YYYYMMDD)<INPUT name="start" type="text" /><br> END(YYYYMMDD)<INPUT name="end" type="text" /><br> TIME STEP SIZE<INPUT name="dt" type="text" /><br> <INPUT type="submit" /> </FORM>
- 2. The PHP script (in this case phptask.php) is set to retrieve the variables that were sent over through the URL with
$<variable>=$_GET['<variable>'];. The code then uses thesystem()command to run an octave code (which is necessary in this case to gather the data correctly).
<?
$database=$_GET['database'];
$start=$_GET['start'];
$end=$_GET['end'];
$dt=$_GET['dt'];
$com="octave -q --eval \"2+2\" 1> out.htm 2>>out.htm";
//$com="octave ts-get($database,start,end,dt)"
system($com);
print "<pre>";
include('out.htm');
print "</pre>";
?>
- Notes
- Edited $com command to include -q (removes beginning information from octave) and 1>out.htm which pipes the results to out.htm and 2>>out.htm which appends the errors to out.htm.
- Problems
- "system()" command fails when trying to execute the file on the root web directory. I found that by moving the files to a subdirectory (in my case php), the "system()" command runs correctly.
