This repository provides a Python solution for extracting specific data from NetCDF files and saving it in a structured format. The primary use case for this code is to extract Sea Surface Temperature (SST) data for a list of islands from two NetCDF files, and save the extracted data into a CSV file.
Before using this code, ensure that you have the following prerequisites:
-
Python: You need to have Python installed on your system. You can download Python from the official website: Python Downloads
-
Required Python Libraries: You should have the following Python libraries installed:
netCDF4
: A library for reading and writing NetCDF files.
You can install these libraries using pip:
pip install netCDF4
-
NetCDF Files: You should have NetCDF files containing the data you want to extract. In this specific example, we assume the existence of two NetCDF files named 'pacific_test.nc' and 'pacific2_test.nc'. the files were not uploaded
-
Clone this GitHub repository to your local machine or download the code files.
-
Place your NetCDF files ('pacific_test.nc' and 'pacific2_test.nc') in the same directory as the Python scripts.
-
Modify the script to define the list of islands and their coordinates as well as other parameters if needed.
-
Run the Python script
alldata.py
. This script will read the NetCDF files, extract the SST data for each island, and save it in a single CSV file ('all_island_data.csv').alldata.py #for all data in both .nc files combined to one csv
You can customize the code by modifying the island names and coordinates according to your specific data and NetCDF file. You can also adapt this code to extract different data variables from the NetCDF files.
This project is licensed under the MIT License
- Eugene Aondo Nyamari