% DATA SUBSET coef=1; rempts=[0 0 0 0]; vlevel = -30; Mask = nc06{'mask_rho'}(:); for time = 2:241 [lat_u, lon_u, mask_u, u_var] = get_var('croco_his_06.nc','croco_his_06.nc','u',time, vlevel, coef, rempts); [lat_v, lon_v, mask_v, v_var] = get_var('croco_his_06.nc','croco_his_06.nc','v',time, vlevel, coef, rempts); [lat_rho, lon_rho, mask, temp] = get_var('croco_his_06.nc','croco_his_06.nc','temp',time, vlevel, coef, rempts); [lat_rho, lon_rho, mask, sal] = get_var('croco_his_06.nc','croco_his_06.nc','salt',time, vlevel, coef, rempts); u_var = u2rho_2d(u_var(:,:)).*Mask; %*mask para quitar tierra v_var = v2rho_2d(v_var(:,:)).*Mask; U(:, :, time) = u_var; V(:, :, time) = v_var; TEMP(:, :, time) = temp; SAL(:, :, time) = sal; end mask_u2 = process_mask(mask); mask_v2 = process_mask(mask); % NEW NC FILE nccreate('croco06prueba.nc','lon_rho','Dimensions',{'eta_rho',468,'xi_rho',436}); ncwriteatt('croco06prueba.nc', 'lon_rho', 'long_name', 'longitude of RHO-points'); ncwriteatt('croco06prueba.nc', 'lon_rho', 'units', 'degree_east'); ncwriteatt('croco06prueba.nc', 'lon_rho', 'field', 'lon_rho, scalar'); ncwriteatt('croco06prueba.nc', 'lon_rho', 'standard_name', 'longitude'); nccreate('croco06prueba.nc','lat_rho','Dimensions',{'eta_rho',468,'xi_rho',436}); ncwriteatt('croco06prueba.nc', 'lat_rho', 'long_name', 'latitude of RHO-points'); ncwriteatt('croco06prueba.nc', 'lat_rho', 'units', 'degree_north'); ncwriteatt('croco06prueba.nc', 'lat_rho', 'field', 'lat_rho, scalar'); ncwriteatt('croco06prueba.nc', 'lat_rho', 'standard_name', 'latitude'); nccreate('croco06prueba.nc','mask_rho','Dimensions',{'eta_rho',468,'xi_rho',436}); ncwriteatt('croco06prueba.nc', 'mask_rho', 'long_name', 'mask on RHO-points'); ncwriteatt('croco06prueba.nc', 'mask_rho', 'option_0', 'land'); ncwriteatt('croco06prueba.nc', 'mask_rho', 'option_1', 'water'); ncwriteatt('croco06prueba.nc', 'mask_rho', 'standard_name', 'land_binary_mask'); ncwriteatt('croco06prueba.nc', 'mask_rho', 'coordinates', 'lon_rho lat_rho'); nccreate('croco06prueba.nc','mask_u','Dimensions',{'xi_u',468,'eta_u',436}); ncwriteatt('croco06prueba.nc', 'mask_u', 'long_name', 'mask on U-points'); ncwriteatt('croco06prueba.nc', 'mask_u', 'option_0', 'land'); ncwriteatt('croco06prueba.nc', 'mask_u', 'option_1', 'water'); nccreate('croco06prueba.nc','mask_v','Dimensions',{'xi_v',468,'eta_v',436}); ncwriteatt('croco06prueba.nc', 'mask_v', 'long_name', 'mask on V-points'); ncwriteatt('croco06prueba.nc', 'mask_v', 'option_0', 'land'); ncwriteatt('croco06prueba.nc', 'mask_v', 'option_1', 'water'); nccreate('croco06prueba.nc','time','Dimensions',{'time',241}); ncwriteatt('croco06prueba.nc', 'time', 'long_name', 'time since initialization'); ncwriteatt('croco06prueba.nc', 'time', 'units', 'second since 2000-01-01 00:00:00'); ncwriteatt('croco06prueba.nc', 'time', 'field', 'time, scalar, series'); ncwriteatt('croco06prueba.nc', 'time', 'standard_name', 'time'); ncwriteatt('croco06prueba.nc', 'time', 'axis', 'T'); nccreate('croco06prueba.nc','u','Dimensions',{'eta_rho',468,'xi_rho',436,'time',241}); ncwriteatt('croco06prueba.nc', 'u', 'long_name', 'u-momentum component'); ncwriteatt('croco06prueba.nc', 'u', 'units', 'meter second-1'); ncwriteatt('croco06prueba.nc', 'u', 'field', 'u-velocity, scalar, series'); ncwriteatt('croco06prueba.nc', 'u', 'standard_name', 'sea_water_x_velocity_at_u_location'); ncwriteatt('croco06prueba.nc', 'u', 'axis', 'lon_u lat_u'); nccreate('croco06prueba.nc','v','Dimensions',{'eta_rho',468,'xi_rho',436,'time',241}); ncwriteatt('croco06prueba.nc', 'v', 'long_name', 'v-momentum component'); ncwriteatt('croco06prueba.nc', 'v', 'units', 'meter second-1'); ncwriteatt('croco06prueba.nc', 'v', 'field', 'v-velocity, scalar, series'); ncwriteatt('croco06prueba.nc', 'v', 'standard_name', 'sea_water_y_velocity_at_u_location'); ncwriteatt('croco06prueba.nc', 'v', 'axis', 'lon_v lat_v'); nccreate('croco06prueba.nc','temp','Dimensions',{'eta_rho',468,'xi_rho',436,'time',241}); ncwriteatt('croco06prueba.nc', 'temp', 'long_name', 'potential temperature'); ncwriteatt('croco06prueba.nc', 'temp', 'units', 'Celsius'); ncwriteatt('croco06prueba.nc', 'temp', 'field', 'temperature, scalar, series'); ncwriteatt('croco06prueba.nc', 'temp', 'standard_name', 'sea_water_potential_temperature'); ncwriteatt('croco06prueba.nc', 'temp', 'coordinates', 'lon_rho lat_rho'); nccreate('croco06prueba.nc','salt','Dimensions',{'eta_rho',468,'xi_rho',436,'time',241}); ncwriteatt('croco06prueba.nc', 'salt', 'long_name', 'salinity'); ncwriteatt('croco06prueba.nc', 'salt', 'units', 'PSU'); ncwriteatt('croco06prueba.nc', 'salt', 'field', 'salinity, scalar, series'); ncwriteatt('croco06prueba.nc', 'salt', 'standard_name', 'sea_water_salinity'); ncwriteatt('croco06prueba.nc', 'salt', 'coordinates', 'lon_rho lat_rho'); ncwrite('croco06prueba.nc','lon_rho',lon_rho); ncwrite('croco06prueba.nc','lat_rho',lat_rho); ncwrite('croco06prueba.nc','mask_rho',mask); ncwrite('croco06prueba.nc','mask_u',mask_u2); ncwrite('croco06prueba.nc','mask_v',mask_v2); ncwrite('croco06prueba.nc','time',t06); ncwrite('croco06prueba.nc','u',U); ncwrite('croco06prueba.nc','v',V); ncwrite('croco06prueba.nc','temp',TEMP); ncwrite('croco06prueba.nc','salt',SAL);