- Timestamp:
- 02/22/23 10:02:51 (14 months ago)
- Location:
- TOOLS/CPLRESTART
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/CPLRESTART/CreateRestartAtm4Oasis.bash
r6228 r6327 63 63 module load hdf5 64 64 module load netcdf-c 65 module load nco 66 module load cdo 67 module load python3 65 module load nco/4.9.1 66 module load cdo/1.9.5 67 module load python3/3.7.2 68 68 module load datadir/igcmg 69 69 module list … … 182 182 python3 create_flxat.py --IsUnstructured=${IsUnstructured} --input flxat_fields_notime.nc --output tmp_flxat.nc 183 183 184 [[ ${IsUnstructured} = yes ]] && ncks --fl_fmt=${FL_FMT} --history --append --variable bounds_lon,bounds_lat flxat.nc tmp_flxat.nc 184 #this is not needed anymore since bounds are included in flxat.py if they exist 185 #[[ ${IsUnstructured} = yes ]] && ncks --fl_fmt=${FL_FMT} --history --append --variable bounds_lon,bounds_lat tmp_flxat.nc 185 186 ncks --fl_fmt=${FL_FMT} --append --history --variable COTAUXXU,COTAUYYU,COTAUZZU,COTAUXXV,COTAUYYV,COTAUZZV,COTOTRAI,COTOTSNO,COTOTEVA,COICEVAP,COQSRMIX,COQNSMIX,COSHFICE,CONSFICE,CODFLXDT,COCALVIN,COLIQRUN,COWINDSP,COTAUMOD tmp_flxat.nc flxat.nc 186 187 -
TOOLS/CPLRESTART/create_flxat.py
r6229 r6327 179 179 COTAUXXV = COTAUXXU ; COTAUYYV = COTAUYYU ; COTAUZZV = COTAUZZU 180 180 181 ## check if bounds for lon lat are present and add them to dataset or drop them 182 ifbnds=True if ('bounds_lon' in d_In.data_vars) and ('bounds_lat' in d_In.data_vars) else False 181 183 182 184 ## Creates final Dataset … … 185 187 lon.attrs['long_name'] = 'Longitude' 186 188 lon.attrs['units'] = 'degrees_east' 187 lon.attrs['bounds'] = 'bounds_lon'189 if ifbnds: lon.attrs['bounds'] = 'bounds_lon' 188 190 189 191 lat = xr.DataArray (lat, dims=('y', 'x')) … … 191 193 lat.attrs['long_name'] = 'Latitude' 192 194 lat.attrs['units'] = 'degrees_north' 193 lat.attrs['bounds'] = 'bounds_lat' 194 195 bounds_lon = d_In.bounds_lon.values.astype (np.float64) 196 bounds_lat = d_In.bounds_lat.values.astype (np.float64) 197 nvertex = bounds_lon.shape[-1] 198 199 bounds_lon = xr.DataArray ( np.reshape (bounds_lon, (ny,nx,nvertex)), dims=('y', 'x', 'nvertex')) 200 bounds_lat = xr.DataArray ( np.reshape (bounds_lat, (ny,nx,nvertex)), dims=('y', 'x', 'nvertex')) 201 202 bounds_lon.attrs['units'] = 'degrees_east' 203 bounds_lat.attrs['units'] = 'degrees_north' 204 205 d_Out = xr.Dataset ( {'lat':lat, 'lon':lon, 'bounds_lon':bounds_lon, 'bounds_lat':bounds_lat, 206 'COTOTRAI':COTOTRAI, 195 if ifbnds: lat.attrs['bounds'] = 'bounds_lat' 196 197 if ifbnds: 198 bounds_lon = d_In.bounds_lon.values.astype (np.float64) 199 bounds_lat = d_In.bounds_lat.values.astype (np.float64) 200 nvertex = bounds_lon.shape[-1] 201 202 bounds_lon = xr.DataArray ( np.reshape (bounds_lon, (ny,nx,nvertex)), dims=('y', 'x', 'nvertex')) 203 bounds_lat = xr.DataArray ( np.reshape (bounds_lat, (ny,nx,nvertex)), dims=('y', 'x', 'nvertex')) 204 205 bounds_lon.attrs['units'] = 'degrees_east' 206 bounds_lat.attrs['units'] = 'degrees_north' 207 208 # prepare dictionnary to export dataset to netcdf file with or without bounds 209 dictdataset = {'lat':lat, 'lon':lon } 210 if ifbnds: dictdataset.update({'bounds_lon':bounds_lon, 'bounds_lat':bounds_lat}) 211 dictdataset.update({'COTOTRAI':COTOTRAI, 207 212 'COTOTSNO':COTOTSNO, 208 213 'COTOTEVA':COTOTEVA, … … 224 229 'COTAUZZV':COTAUZZV } ) 225 230 231 d_Out = xr.Dataset (dictdataset) 232 226 233 d_Out.attrs['Associated files'] = myargs.input 227 234 d_Out.attrs['Conventions'] = "CF-1.6"
Note: See TracChangeset
for help on using the changeset viewer.