Landsat 8 new L1TP data metadata MtL can not be read in PCI geomatics - landsat

How do I use pic.fimport to open a Landsat 8 metadata MTL?
I do not know why fimport cannot read the new MTL txt file.

When use fimport to read the MTL.txt
I add ms in end of the file name
But it says file does not exit
Either with or without ms , it says file does not exist

Related

Record audio data to an existing media file using FFMPEG API

My task is to record the received audio data in a media file. I have no problem with this, everything works fine. But, when closing the audio file, I will no longer be able to re-open it and write the audio data to the end of the audio file. How do I solve this problem ? And in general, is it possible to write new data to the end of an existing media file ?
This is a piece of code where I record the trailer and close the media file:
// Writing the stream trailer to an output
// media file and free the file private data.
av_write_trailer(p_oFrmCtx);
avformat_close_input(&p_oFrmCtx);
As far as I know, opening an existing audio file and writing to it is not possible. What you can do is write the incoming data to a new file and merge it with the previous one (the one at the end of which you wanted to write the data). You can use below command to achieve that.
ffmpeg -i "concat:file1.mp3|file2.mp3" -acodec copy output.mp3
If you have a list of files to be merged together, run the below command
$ ffmpeg -f concat -safe 0 -i filelist.txt -c copy output.mp3
Note the list should be of following format
$ cat filelist.txt
file '/audio/001.mp3'
file '/audio/002.mp3'
file '/audio/003.mp3'
file '/audio/004.mp3'

How to open file with ofstream so that other users can append/write to same file?

We have a binary which creates a daily CSV report with some file name like Sample_20170523 i.e filename appended with current date but now the issue is when some other runs the binary on the same day then there is error unable to open the file.Code snippet for this issue is as follows:
std::ofstream of;
of.open("FileName_20170523",ios::out);
if(!of)
std::cout<<"Unable to open file..."<<std::endl;
So after checking it seems this problem arises because the file was already created by another user. So just wanted to know is there any mechanism in c++ in which we can give 777 permissions to programmatically created file ?
You can use either chmod() or fchmod() to change the permission of a file.
system() allows to execute system commands.
system("chmod 777 diretory_to_file/name");
gives r+w+x to everyone if it already exits
std::ofstream of;
of.open("FileName_20170523",ios::out);

Does opening a file in append mode to write in c++ allocates memory for whole file?

Does opening a file in append mode to write in c++ allocates memory for the whole file?
Say I have a file, then I opened in append mode and after the final append the file is 34 GB. Now if the file write operation is frequent and done by different tasks, which opens the file every time to append some data to it. just before the final write(when the size of the file is about 30 GB) will the OS allocate 30 GB for opening a file?
Short answer: no. Opening the file, in any mode, does not allocate memory for the whole file. You may have that confused with memory-mapping a file, which can and usually does.

Convert gds file into text format using gds2text script

How I can to read any gdsii file in python,or Convert gds file into text format using gds2text script?
If you can use a C/C++ compiler you might consider using gds2gdt and gdt2gds to read and/or write GDSII using any language/shell of your choice. GDSII is a stream of records each of which is represented in a single line of compact GDT format text. For instance:
p{10 w1.2 xy(41.2 17.1 41.2 33.9)}
is a two-point path on layer 10 with a width of 1.2. you can run these programs externally or call them within your program similar to reading/writing a text file.
https://sourceforge.net/projects/gds2/

std::ofstream open file and replace in specific offset

I want to open a file (without re-creating it) and write to a specific offset.
This is the current code :
std::ofstream file(conf_file_path, std::ios::app);
file.seekp(offset, std::ios::beg);
const auto& output = file.write(conf_str, conf_str_len);
But it always writes to the end of file (probably due to the app flag)
If I don't use the app flag, it re-creates the file as I open it.
How can I open it without re-create it and be able to write to specific offset ?
it always writes to the end of file (probably due to the app flag)
Yes, this is due to the app flag. Here's what the documentation says:
app - seek to the end of stream before each write
If I don't use the app flag, it re-creates the file as I open it.
If you have out or trunc flags sets in the mode, then it destroys the contents of the file, if it already exists.
How can I open it without re-create it and be able to write to specific offset ?
You may use in|out. This will error out if the file doesn't exist; if it exists, the file will be opened and read from the beginning. If you want the stream to be read from the end, you may set the ate flag additionally.
All of this is clearly documented here; reading the manual really helps.