A tool to convert the subset regional LLC4320 data to NetCDF files. Without modification, it only works within the AMES supercomputer.
Writen by Jinbo Wang to support the SWOT AdAC pre-launch activities.
- Install Miniconda in the home directory.
- Include necessary modules (this may be different after software updates):
source miniconda3/bin/activate module load pkgsrc/2021Q2 mpi-hpe/mpt
- Run from an interactive cluster:
- Start an interactive cluster:
qsub -I -q devel -lselect=$1:ncpus=$2:model=$3,walltime=2:00:00
- Start an interactive cluster:
-
Clone this repository to your local machine:
git clone https://github.com/jinbow/LLC4320_regional.git
-
Install the required Python libraries:
pip install mpi4py numpy xarray pandas netCDF4
To run the script, use the following command from the cluster:
mpiexec -np <number_of_processes> python convert_netcdf_mpi.py
Replace <number_of_processes>
with the number of parallel processes you will use. You may need to change the settings in the main routine of the program.
mpiexec -np 4 python convert_netcdf_mpi.py 0
This command will run the script with 4 MPI processes to process the first region in the region_names
list.
Use pbs.sh to submit large jobs that make more than 2 hours.
The output files are saved in the folder: /nobackup/jwang23/llc4320_stripe/regional.subsets.adac.netcdf
. Change this to your nobackup folder.
The script processes data for the following regions:
- GotlandBasin
- Boknis
- NewCaledonia
- NWAustralia
- CalSWOT2
- SOFS
- Yongala
- WestAtlantic
- ACC_SMST
The metadata for these regions is defined in the names
dictionary within the script.
The output has been published on podaac: [https://podaac.jpl.nasa.gov/cloud-datasets?search=Pre-SWOT%20Level-4%20Hourly%20MITgcm%20LLC4320]
Processes and generates NetCDF files for a specified region using MPI for parallel computation.
Parameters:
region_name
(str): Name of the region to process.comm
(MPI.Comm): MPI communicator for parallel processing.
Loads variable metadata from a JSON file and enhances it with additional information.
Parameters:
fn
(str): Path to the JSON file containing variable metadata.
Returns:
- dict: Dictionary containing enhanced variable metadata, with variable names as keys and their metadata as values.
Loads global metadata from a JSON file and extracts relevant values.
Parameters:
fn
(str): Path to the JSON file containing global metadata.
Returns:
- dict: Dictionary containing global metadata values, with metadata names as keys and their corresponding values as dictionary values.
Reads coordinate metadata for the model grid.
Parameters:
ph
(str): Path to the grid data.nx
(int): Number of grid points in the x-direction.ny
(int): Number of grid points in the y-direction.nz
(int): Number of grid points in the z-direction.
Returns:
xarray.Dataset
: Dataset containing grid metadata and coordinates.
Parses the filename to extract metadata.
Parameters:
fn
(str): Filename to be parsed.
Returns:
- tuple: Parsed metadata including:
tt
(str): Extracted time string from the filename.nx
(int): Number of grid points in the x-direction.ny
(int): Number of grid points in the y-direction.nz
(int): Number of grid points in the z-direction.i0
(int): Initial index in the x-direction.j0
(int): Initial index in the y-direction.k0
(int): Initial index in the z-direction.
Feel free to open issues or submit pull requests if you have any suggestions or improvements.
The JSON files for the MITgcm output are from Ian Fenty.
This project is licensed under the MIT License.