import netCDF4 as nc
import numpy as np

# Define dimensions
y_size_1 = 88838
y_size_2 = 105704
y_size_3 = 131072
x_size = 1

# Create NetCDF file
rstas_file = nc.Dataset('rstas.nc', 'w', format='NETCDF4')
rstos_file = nc.Dataset('rstos.nc', 'w', format='NETCDF4')

# Define dimensions in the NetCDF file
rstas_file.createDimension('y', y_size_1)
rstas_file.createDimension('x', x_size)
rstos_file.createDimension('y', y_size_2)
rstos_file.createDimension('x', x_size)

# Create a variable 'O_f1_atm'
f1 = rstas_file.createVariable('A_f1_oce', 'f4', ('y', 'x'))
f2 = rstas_file.createVariable('A_f2_rnf', 'f4', ('y', 'x'))
f3 = rstas_file.createVariable('R_f3_oce', 'f4', ('y', 'x'))
f4 = rstos_file.createVariable('O_f4_atm', 'f4', ('y', 'x'))

# Generate some dummy data for the variable
data_1 = np.random.rand(y_size_1, x_size)
data_2 = np.random.rand(y_size_2, x_size)


# Assign data to the variable
f1[:, :] = data_1
f2[:, :] = data_1
f3[:, :] = data_1
f4[:, :] = data_2

# Close the NetCDF file
rstas_file.close()
rstos_file.close()

