Help Of "Open NC File" tool
How to open and read time series from nc files by using coordinates.
How can we run the "Open NC File" tool?
The "Open NC file" is an applicable tool for opening different NC files. For applying the "Open NC file" tool please following the steps one by one. During the running steps of "Open NC file", several important tips have been mentioned. Be aware to well understand of them. If you have any question or further descriptions feel free to send us an email (Kolsoomi57@gmail.com):
Step 1 - Open nc file:
In the first step, after getting a key by purchasing the "Open NC file" tool, open your intent file/files such as Fig. 1 No.1 and Fig. 2. By clicking the "Open" button (Fig. 2), then the user can observe the list of NC files and the details (Fig. 3).
Fig. 1 - The main screen of the “Open NC file” tool with the open file/files icon.
Fig. 2 - Select the desirable file/files by browsing.
Step 2 - Set nc file:
In the “Open NC file” tool, when the user selects his/her files then he/she can view the details of each variable which embedded in the file. As you can see in Fig. 3, in the “Files” panel you can view two options, namely “Latitude” and “Longitude”. The two variables are in the selected file/files that the users load them. The codes of the “Open NC file” tool, has searched the both mentioned variables in the loaded file/files, and if the codes can find the exact name of the variables they would appear in the Fig. 3 No. 1, at “Open NC file” tool.
All the loaded files have been presented in Fig. 3 No. 2. Attention please, since both variables are “latitude” and “longitude” in the files, so you can see the same one in the blank spaces. Be aware, if they have another writing such as “lat” and “lon”, then you can see “lat” and “lon” in the blank spaces (Fig. 3 No. 1). If the loaded files have different and unusual writing of the variables, such as “L1” and “L2”, then the codes of “Open NC file” tool can't find both variables, and you should write the assigned name in the blank spaces.
Fig. 3 - Set the spatial dimensions.
By checking the details of the characteristics of each loaded file you can recognize every variable in it in the “Open NC file” tool, such as the writing of “latitude” and “longitude”. As you can see in Fig. 4 No. 1, you can exactly view all the variables in the selected file, at “Open NC file” tool”. As is shown in Fig. 4 No. 1, the “AgMERRA_2006_prate.n4” file has four variables, including prate, time, latitude, and longitude. By expanding each variable in the “Files” panel (Fig. 5 No. 1), you can view the dimensions of each variable in the “Open NC file” tool.
Fig. 4 - See the variables name with other different details.
For better clarification in this section of “Open NC file” tool, please consider the variable “prate” in Fig. 5 No. 1, after expanding it. It has three dimensions, including time, latitude, and longitude. One of them (time) has “UNLIMITED” length, the “longitude” dimension has a length equal to 1440, and the last one “latitude” has 720 lengths, you can see them easily in “Open NC file” tool.
Fig. 5 - See the dimensions of variables.
Be aware in this step we have three situations, namely 1- Standard files (such as this example for the AgMERRA data), 2- Such files that they have “time” dimension without “UNLIMITED” length (such as PERSIANN data), 3- Such files that they don’t have not time nor “UNLIMITED”.
For the standard case, we have the first example through “AgMERRA” data that in the “Open NC file” tool the loaded files have a dimension equal to “UNLIMITED” length, so you can easily work with it. For the second case, the loaded file has not a variable with “UNLIMITED” dimension then you face to another window and a message for writing some details. For a better understanding of the point, please take attention to another example, after this example we will continue the first example and the rest of the steps for the “AgMERRA” example.
Suppose that you have loaded several files of “PERSIANN” dataset. By tracking the same steps as the previous example in the “Open NC file” tool, when you want to see the dimensions and the related lengths you will face to the window and a message as Fig. 6. See this figure (Fig. 6 No. 1) and the loaded files, as you see the variables you can find out that the “time” dimension has not “UNLIMITED” length, so in Fig. 6 No. 2, the first radio button should be selected (Fig. 6 No. 2) and you see the exact name has been written in No. 1, in the “Dimension” panel (Fig. 6 No. 3). If the file has an unusual writing of the dimension, then the user should write the name of the dimension as the content of the file. For example, if the writing of the time dimension is equal to “T”, then the user should write it in the blank space (Fig. 6 No. 3) in the “Open NC file” tool.
Finally, in the third case, the user should select the second radio button as Fig. 6 No. 4, and then click on the “Merge” button, and follow the rest of steps for completing the process of “Open NC file” tool.
Fig. 6 - See the case 2 where we have time dimension without “UNLIMITED” length.
OK, by understanding the exceptions about different cases of the “UNLIMITED” length, now we can continue the rest of the steps in the first example of the “AgMERRA” files in Fig. 5, via “Open NC file” tool.
Step3 - Select unlimited Simension
In the “Open NC file” tool at the “Options of Files” panel, the user should determine the size of “UNLIMITED” dimension, with writing it in the “Select Unlimited GNs” panel with two fields, including “Start From” and “Numbers”. In this example, as you can see, the filled values start from 1 to 1826 (Fig. 7 No. 1). As you can see in Fig. 7 No. 2, the loaded file of the AgMERRA dataset are started from 2006 to 2010 for precipitation data, in the “Open NC file” tool. The first loaded file for 2006 has 365 days (1 to 365), the second one is related to 2007 (366 to 730), and up to 2010 (1462 to 1826). The numbers are related to the “UNLIMITED” dimension, namely “time”. So, in the last message for merging the files, you can see “Merge all files in time: Start from 1 to 1826” (Fig. 7 No. 2). Finally, you see a report sentence which states “Merge all file” message in Fig. 7 No.3, at “Open NC file” tool, so it means all the file will merge together.
Fig. 7 -Select the GNs and "Merge all files…" message for merging the loaded files.
Step4 - Select Stations and extract data
The last panel in the “Open NC file” tool, is “Extract” section at the “Open NC file” tool. For this step, there is two cases, including:
1- The user types the station's name with latitude and longitude.
2- The user loads the intent files in the different format of data, namely xls, CSV, and txt. For the xls and CSV format files, a new window will open. For the text file, the user should determine and type the “delimiter” in the loaded file.
Now, we want to continue the rest of the extract process via “Open NC file” tool. In case 1 (Fig. 8 No. 1), after typing the name of stations with latitude and longitude, the user should write the name of the variable in the blank space (Fig. 8 No. 2) according to the name of it in the content of the file. Be careful, with entering the wrong name, the user face with an error. In this example the name of the variable is “prate”, so you can see it in the blank space as Fig. 8 No. 2, at “Open NC file” tool.
By pressing the “Extract” button as Fig. 8 No. 3, the user can see the data which are extracted for the two stations in the “Data” table (Fig. 8 No. 4). If you want to see the location of the selected stations you can click the “Stations on Map” as Fig. 8 No. 5, then you can see them on a map as Fig. 9, in the “Open NC file” tool. If you want to export the data to an excel file, so you can click the “Save to File” as Fig. 8 No. 6. By clicking it, then you see a window as Fig. 10, and you can select a name for your file (Fig. 10 No. 1), and then save it in your system. By clicking the “Save” button (Fig. 10 No. 2), another window will open in “Open NC file” tool.
Fig. 8 - Write the stations in the list with latitude and longitude.
Fig. 9 - The location of the stations which are presented on the map.
Fig. 10 - A window for typing a name for your data.
Fig. 11 shows you some characteristics that by typing them you can add some details as the header of the file, such as Project Name, Start Date, Unit, and etc., if you don’t like to add anything so by clicking “Cancel” you can ignore them.
Fig. 11 - Set the details of your file if you want add some details as the header of file
In case 2, when a user wants to use another file which has the data of a region or stations, the user can load the file, and can present the data of file for extracting, so by writing the specified delimiter in the blank space of “If you want to browse text file use delimiter” in Fig. 12 No. 1, then you can click “Fill list by file” button (Fig. 12 No. 2) and see another page for browsing your intent file as Fig. 13. In this example, the file name is STs(1).xlsx.
Fig. 12 - Set the delimiter of loaded file.
Fig. 13 - Browse your desirable file and load it
By recall and load, the file a new page will open as Fig. 14. There are different options in this window. The First one as Fig. 14 No. 1, in this one you should select your desirable sheet. Here, in this sample it is “sheet1”, then if the load file has a row as the “Header” (Fig. 14 No. 2), check on the option.
Fig. 14 - Browse your desirable sheet and load it
When the user clicks the “Load Data” button then the data are presented in the below table as Fig. 15 No. 1. As you see Fig. 15 No. 1, you can observe that each of column has been assigned by a name, easily. Also, you can view a panel with the name of “Conversion” (Fig. 15 No. 2). If your data file has another type of geographic system, so you can convert them to your desired one in this section. Finally, by clicking “Load Data” (Fig. 15 No. 3), as “Fig. 16”, you can see the extracted data in the main screen.
Fig. 15 - Assign the name of each column of data.
Fig. 16 - See the extracted data in the table.