How to merge multiple .HDF5 files in single file in Octave - octave

I have multiple .HDF5 files of 30 min IMERG precipitation data for a month (July 2022) in a folder having same shape.
Is there a way to merge multiple files in a single file through Octave or any other source?
If not the how to open multiple files at once and access the data within the files.
I have tried this but getting an error
data = data_from_multiple_HDF5_files('F:\Task_3_IMERG\HDF5_Practice', '*.HDF5' )
error: 'data_from_multiple_HDF5_files' undefined near line 1, column 1

Related

SSIS-Variable File Name

I have a folder in which every month I will put a single excel file with name (depending on the month) like 'Jun file', 'Jul file', 'Aug file' and others. I want to move this file from folder to Sql database and form the table of the same name, that is 'Jun file'(if it is the June Month's file).
I am trying to do it through SSIS by forming the variable but I am unable to do it. How should I create the variable for this varying file name.

Missing rows while exporting more than 1 milliion record into csv file via SSIS

Task : Need to export 1.1 million records to a csv file
I loaded it via SSIS Dataflow.
As you can see there are 1,100,800 rows that is loaded from a table(Source) to the FlatFile location which is a CSV file.
My FlatFile destination Source filename is Test.csv
Now when i open the csv file i get the error
"file not loaded completely"
Now when i see the record at the very end of my csv file .Sorry cannot attache the csv file due to data integrity.
So i only see record till 1048578 but the row i loaded was 1,100880 so there are some missing rows and i cannot add them manually as well . See the end of the csv it does not let me type to the next row.
Any idea why?
As for workaround i loaded in to seperate csv file 1 million in 1 csv and rest in others.
But i really wanna know why it is doing this.
Thank you in advance for looking at this.
It's Excel's fault. It only supports 1,048,576 rows.
https://support.office.com/en-us/article/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3
The error you're getting is because you're trying to open a .csv with more than the acceptable number of rows. Try opening the file in a different app, like Notepad++.

Do a VLOOKUP of a database that is too large to open in excel

I am trying to do a VLOOKUP query into an Excel file (File 1) with about 500,000 rows from another csv file (File 2) that has about 4.5 million rows. This second file is too large to fully load in Excel, and so I am unsure how to proceed.
I am attempting to import data from File 2 to File 1 based on matching the unique PointID identifier in Column B in both files. I also have File 2 in an Access database if that works better. I have tried indicating the 'table_array' index in File 1 without opening File 2, but am receiving an error message.
Is there a way I can iterate over File 2 like a VLOOKUP without opening it or receiving an error message?
If you've already got File 2 in Access I would import File 1 into Access as well. Make sure that File 1 has its PointID set as the Primary Key, then you should be able to use an Update query in Access to get the relevant values from File 2 into File 1. You would then export the updated File 1 data back to a new Excel file (if that's where you need it to be).
I can't think of an easy way to update the original File 1 directly. It doesn't work if you add File 1 as a linked table in Access because the data isn't updateable as far as I can tell (I did try this, but I am working on older copies of Excel/Access so maybe newer versions may allow it).

How do you get flat file name and perform a row count from multiple flat files with different columns in SSIS?

I'm trying to get all the file names from a folder directory along with their row counts. (Also file size in bytes if possible) I am using Microsoft Visual Studio 2010 Shell. Here's what I've done so far:
I have created a Foreach Loop Container, set the Enumerator to Foreach File Enumerator and Expressions to a variable to the folder I want to loop over. I left the Files section with *.* and asked to retrieve Name Only. I have changed the Variable Mappings to a New Variable called FullFilePath, Container is Package, Value type is String and Value: is blank.
I then added a Data Flow to the Loop. Added a flat file source, row count, and OLE DB Destination. I changed the Flat file Source properties expression to the same Folder Variable in the Foreach Loop Container Expression. I added the Variable RecordCount to the Row Count function (Int32, value 0). The OLE DB Destination creates a new table with the name OLE DB Destination.
The next step is a Execute SQL Task that does and Insert Into DBO.FileData (FileName,RowCount) Values (?,?). I set 2 parameter mappings - 1) Variable Name from the Foreach Loop Container, FullFilePath and Data Type VarChar, 2) Variable from Row Count, RecordCount and Data Type Long.
I then have another Execute SQL Task that drops the table created by the data flow task. The problem is that with all the these step the Package still does not complete. It actually gets hung up and fails on the pre-execute. It says:
Warning: Access is denied. Error: Cannot open the datafile 'FullFilePath' Error: Flat File Source failed the pre-execute phase and returned error code 0xC020200E.
Anything you see I could be doing wrong? Let me know if pictures would help.
So I figured this out finally. In order to loop over all of the files with varying headers and column counts I decided to change the option in the Flat File Source to unselect "File contains headers." Doing this allowed the all the files to have the same #1 Column, which by default is Column 0(the first column in all of my files is some sort of a numeric field or ID). I was able to map this through row count and insert into a SQL table. Then I was able to finish the Foreach Loop and scribe the file name and row count into another SQL table to record the counts. It is however taking a really really really long time, i.e. it has been running for over 14 hours and it has only counted through 13 files. Granted some files are 250K+ rows but I wouldn't think it would take this long.

fetching data from multiple file and loading it into raw file destination(raw file should be dynamic) in ssis

I have a source folder which contains 4 csv files with different no of columns in each of the file. I need to fetch only 3 columns(metadata same this 3 columns in all the 4 files) from each csv and load the columns inside Raw Destination from all the files avaiable in source folder. And Raw destination Output file name has to be like wht the inputfilename we are fetching + time stamp.
And at next level, i need to fetch this output raw as raw source and insert this records into oledb destination . and the destination table also has to be in dynamic.
for example i have 4 csv files called, test1.csv(10 columns). test2.csv(8), test3.csv(6), test4.csv(10) along with time stamps.
all this 4 files has columns position_id, asofdate, sumassured in common, now i want to load only these 3 columns to raw destination. If i load test1.csv then my raw destination outputfile name has to be RW_test1_20120119_222222.RW. similalrly if i load second file its filename as raw destination output..
Thanks
Satish
As always, decompose your problems until you've got it into a something you can manage.
Processing CSVs via queries
Following the two questions and answers below will result in a package with an OLEDB Connection Manager configured to operate on CSVs in the folder #[User::InputFolder]. 3 variables CurrentFileName, InputFolder and Query have been defined with an expression set on Query.
The expression for your #[User::Query] would look like "SELECT position_id, asofdate, sumassured FROM " + #[User::CurrentFileName]
Reference answers
SSIS FlatFile Acces via Jet
SSIS Task for inconsistent column count import?
At this point, your package should resemble the center piece below. Verify you can correctly enumerate all of the CSVs in the folder and the OLEDB query piece works.
RAW files
I'm not an expert on RAW file usage so there may be better ways of interacting with them. This will use the fourth variable, RawFileName. Set an expression on it like #[User::InputFolder] + "RawFile.raw" which would result in the file being written to C:\ssisdata\so\satishkumar\RawFile.raw
My general approach is to have a dataflow with a script task that sends no rows into a RAW File Destination.
Configure your destination as
Access mode: File name from variable
Variable name: User::RawFileName
Write option: Create Always
Process CSVs
The concept here is to append all the data into the RAW file that was created in the initial step.
Your source should already be configured as
OLE DB connection manager: FlatFile
Data access mode: SQL command from variable
Variable name: User::Query
Configure your destination as
Access mode: File name from variable
Variable name: User::RawFileName
Write option: Append
Extract from RAW
At this point, the foreach enumerator has completed and all the data has been loaded into the staging file. Now it is time to consume that and send data on to the destination.
Drag a Raw File Source Transformation onto your data flow. Unsurprisingly, you will configure as
Access mode: File name from variable
Variable name: User::RawFileName
Instead of Simulate destination, wire it up to the correct data destination.
Caveat
Be careful when using an expression with GETDATE/GETUTCDATE to define filenames as they are constantly evaluated. In 2005, we had used FileName_HHMMSS and had issues because processing didn't complete in the same second between the creation of a file and the next task that consumed the file. Instead, I have had better success using a dynamic but fixed starting point and generally, that is the system variable, StartTime #[System::StartTime]
You can use ForEach Loop Container on the Control Flow Diagram to iterate txt and csv files.