Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

NETCDF TO INTERMEDIATE FILE

claort

New member
Hi
i need to convert a netcdf file to intermediate file to be processed with metgrid
i did not found any script . can you help me ?

tks
 
Unfortunately we don't have a specific script to do so. But you can always look at the the document below, which describes in detail how to write data in intermediate format:
Please take a look and let me know you have more questions.
 
Last edited:
Hi,
Certainly! I can help you with converting a NetCDF file to an intermediate file that can be processed with Metgrid. To accomplish this, you can make use of the NetCDF Operators (NCO) toolkit, which provides a set of command-line tools for working with NetCDF files.

Here's a step-by-step guide to convert a NetCDF file to an intermediate file format for Metgrid:

Install NCO: If you don't have NCO installed, you can download and install it from the official website: NCO Homepage. Follow the installation instructions specific to your operating system.

Convert NetCDF to intermediate format: Once you have NCO installed, you can use the ncks command to extract the variables you need from the NetCDF file and save them in a new file format that can be processed with Metgrid. The intermediate file format typically used with Metgrid is a simple ASCII format with space-separated values. Mykplan Sign In


Here's an example command to convert a NetCDF file named "input.nc" to the intermediate format:
ncks -v variable1,variable2 input.nc > output.txt

In the above command, replace "variable1" and "variable2" with the actual variable names you want to extract from the NetCDF file. The command will create a new file named "output.txt" containing the extracted variables in the intermediate format.

Process with Metgrid: Once you have the intermediate file in the desired format, you can use it as input for further processing with Metgrid.
Please note that the specific variables and options you need to extract from the NetCDF file may vary depending on your specific use case and requirements. Make sure to adjust the ncks command accordingly to extract the necessary variables.

I hope this helps! Let me know if you have any further questions.
 
Last edited:
Hi
I tested the solution but i believe there Is an issue.
I used ncks to extract the file as for your suggestion. The variabile Is only One so It is very Simple the command. It produced a file .txt
I set metgrib info on WPS file (constants_name= filename) and run metgrib but i received an error: bad file descriptor.

I tried to produce a binary file with ncks instead of txt file using -b option but It Is the same.
What could be the problem ?
Tks
 
The method indicate above Is not correct. To produce the right intermediate file you Need to use a python library called pywinter . This works very fine.
 
Top