Commit 23fba7a91cfb588dd54a337a86d5c55b16de911f
1 parent
0cb6a7aa
Exists in
master
and in
109 other branches
no temp file for CdfSampling
Showing
3 changed files
with
18 additions
and
12 deletions
Show diff stats
php/classes/FilesMgr.php
@@ -120,19 +120,13 @@ class FilesMgr extends AmdaObjectMgr | @@ -120,19 +120,13 @@ class FilesMgr extends AmdaObjectMgr | ||
120 | return array('type' => $data_type, 'size' => $size, 'n_records' => $n_recs, 'units' => $units, 'fillvalue' => $fillval); | 120 | return array('type' => $data_type, 'size' => $size, 'n_records' => $n_recs, 'units' => $units, 'fillvalue' => $fillval); |
121 | } | 121 | } |
122 | 122 | ||
123 | - public function getCdfSampling() { | ||
124 | - copy($this->fileName, "temp.cdf"); | ||
125 | - exec('cdfsamplingfromdata ', $results); | ||
126 | - unlink("temp.cdf"); | ||
127 | - | 123 | + public function getCdfSampling() { |
124 | + exec('cdfsamplingfromdata '.$this->fileName, $results); | ||
128 | return $results; | 125 | return $results; |
129 | } | 126 | } |
130 | 127 | ||
131 | - public function getCdfSamplings() { | ||
132 | - copy($this->fileName, "temp.cdf"); | ||
133 | - exec('cdfsamplingsfromdata ', $results); | ||
134 | - unlink("temp.cdf"); | ||
135 | - | 128 | + public function getCdfSamplings() { |
129 | + exec('cdfsamplingsfromdata '.$this->fileName, $results); | ||
136 | return $results; | 130 | return $results; |
137 | } | 131 | } |
138 | /* | 132 | /* |
php/src/cdfsamplingfromdata.c
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | #include <time.h> | 7 | #include <time.h> |
8 | #include <math.h> | 8 | #include <math.h> |
9 | 9 | ||
10 | -#define fileName "temp.cdf" | 10 | +#define MAX_FILE_NAME_LEN 120 |
11 | #define badFile -100 | 11 | #define badFile -100 |
12 | 12 | ||
13 | /************************************* | 13 | /************************************* |
@@ -45,6 +45,7 @@ void cdf_handle_error(CDFstatus status) | @@ -45,6 +45,7 @@ void cdf_handle_error(CDFstatus status) | ||
45 | 45 | ||
46 | int main(int argc, char *argv[]) | 46 | int main(int argc, char *argv[]) |
47 | { | 47 | { |
48 | + char fileName[MAX_FILE_NAME_LEN]; | ||
48 | long RecStart = 0, RecCount = 2, RecInt = 1; | 49 | long RecStart = 0, RecCount = 2, RecInt = 1; |
49 | long indices[1] = {0}, intervals[1] = {1}, counts[1] = {1}; | 50 | long indices[1] = {0}, intervals[1] = {1}, counts[1] = {1}; |
50 | long varN = -1; | 51 | long varN = -1; |
@@ -58,6 +59,11 @@ int main(int argc, char *argv[]) | @@ -58,6 +59,11 @@ int main(int argc, char *argv[]) | ||
58 | double epoch16[2], dbl_value, dbl_value_; | 59 | double epoch16[2], dbl_value, dbl_value_; |
59 | long year, month, day, hour, minute, sec, msec, mksec, nsec, psec; | 60 | long year, month, day, hour, minute, sec, msec, mksec, nsec, psec; |
60 | long long *int_value; | 61 | long long *int_value; |
62 | + | ||
63 | + if (argc <= 1) | ||
64 | + exit(0); /* CDF input file name not specified */ | ||
65 | + else | ||
66 | + strcpy(fileName, argv[argc-1]); /* Get the input file name */ | ||
61 | 67 | ||
62 | /*********************** Open CDF file *****************************/ | 68 | /*********************** Open CDF file *****************************/ |
63 | if ((cstatus = CDFopen(fileName, &id)) != CDF_OK) | 69 | if ((cstatus = CDFopen(fileName, &id)) != CDF_OK) |
php/src/cdfsamplingsfromdata.c
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | #include <time.h> | 10 | #include <time.h> |
11 | #include <math.h> | 11 | #include <math.h> |
12 | 12 | ||
13 | -#define fileName "temp.cdf" | 13 | +#define MAX_FILE_NAME_LEN 120 |
14 | #define badFile -100 | 14 | #define badFile -100 |
15 | 15 | ||
16 | /************************************* | 16 | /************************************* |
@@ -76,6 +76,7 @@ void find_min(int* delta, int nRecs, int minFalse, int* minVal) | @@ -76,6 +76,7 @@ void find_min(int* delta, int nRecs, int minFalse, int* minVal) | ||
76 | 76 | ||
77 | int main(int argc, char *argv[]) | 77 | int main(int argc, char *argv[]) |
78 | { | 78 | { |
79 | + char fileName[MAX_FILE_NAME_LEN]; | ||
79 | long RecStart = 0, RecCount, RecInt = 1; | 80 | long RecStart = 0, RecCount, RecInt = 1; |
80 | long indices[1] = {0}, intervals[1] = {1}, counts[1] = {1}; | 81 | long indices[1] = {0}, intervals[1] = {1}, counts[1] = {1}; |
81 | long varN = -1; | 82 | long varN = -1; |
@@ -91,6 +92,11 @@ int main(int argc, char *argv[]) | @@ -91,6 +92,11 @@ int main(int argc, char *argv[]) | ||
91 | double epoch16[2], dbl_value, dbl_value_; | 92 | double epoch16[2], dbl_value, dbl_value_; |
92 | long year, month, day, hour, minute, sec, msec, mksec, nsec, psec; | 93 | long year, month, day, hour, minute, sec, msec, mksec, nsec, psec; |
93 | long long *int_value; | 94 | long long *int_value; |
95 | + | ||
96 | + if (argc <= 1) | ||
97 | + exit(0); /* CDF input file name not specified */ | ||
98 | + else | ||
99 | + strcpy(fileName, argv[argc-1]); /* Get the input file name */ | ||
94 | 100 | ||
95 | /*********************** Open CDF file *****************************/ | 101 | /*********************** Open CDF file *****************************/ |
96 | if ((cstatus = CDFopen(fileName, &id)) != CDF_OK) | 102 | if ((cstatus = CDFopen(fileName, &id)) != CDF_OK) |