Fortran How to Handle Outliers in Array Data in Fortran?

  • Thread starter Thread starter kevin86
  • Start date Start date
  • Tags Tags
    Array Fortran
AI Thread Summary
The discussion focuses on strategies for handling outliers in data stored in an array. Key points include the suggestion to eliminate outliers during the initial data loading process to prevent future issues. If that isn't feasible, creating a utility program to filter and store only valid records is recommended, particularly using allocatable arrays in Fortran 90 to manage memory efficiently. If neither option is suitable, participants discuss the necessity of manually copying and shifting array elements to remove outliers, while noting that this approach does not reclaim memory space. The effectiveness of these methods may vary based on the size of the dataset and the frequency of outlier occurrences.
kevin86
Messages
20
Reaction score
0
Hello

I have a bunch of data in a text file that got loaded into an array. Now the problem is that there are a lot of outliers. So let's say if I find the outlier, how do I get rid of it, by say move the next one to that spot. If I do that how do I redefine the arrary size. What would be the best way to do it? I don't need to do it my way. I just need to get rid of the outliers anyway possible
 
Technology news on Phys.org
Without knowing the order of magnitude of your data size (100 record, or 1000000 records?), and how frequently you find your outliers, that is once and for all, occasionally, 3 times a day, every time you run..., it is not easy to suggest an optimal solution.
For now, I could suggest some possibilities:

1. If possible, eliminate the 'outliers' while reading into the array, this way, you get rid of the problem at the source (once and for all).

2. If option 1 is not possible, you could write a utility program to write the 'good' records to a file and read it back into your original program every time you encounter an 'outlier'.
In the case of F90, you have the option of using allocatable arrays instead of using a disk file. You only have to allocate a new array of the correct size, and copy the good records to the new arrary, and deallocate the old one containing outliers.

3. If the above steps are not acceptable for one reason or another, you will have to take the time to do some copying and shifting of the array elements, which is not really hard to do. Be sure that if the array contents are indexed, the index has to be updated as well.
You do not, however, recuperate the memory space so saved.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
20
Views
3K
Replies
4
Views
2K
Replies
13
Views
3K
Replies
5
Views
4K
Replies
2
Views
2K
Replies
13
Views
2K
Back
Top