Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Prepare regional atmosphere data

Yuan Sun

Yuan Sun
Member
What version of the code are you using?
CTSM5.2

Describe every step you took leading up to the problem:
I am preparing regional atmosphere data from external sources. The script to generate lnd_mesh and mask_mesh is below:

#!/bin/bash
# Yuan Sun, 2024-9-25, Manchester, UK
# This script is used for make surface region for manchester with esmf8.6.1
module load apps/binapps/anaconda3/2023.09
conda activate yuanenv
module load libs/gcc/nco/4.8.1
module load use.own
module load hdf5/1.12.3
export HOME=/mnt/iusers01/fatpou01/sees01/a16404ys
export CESM_ROOT=${HOME}/CESM
export TOOL_SCRIPT=$CESM_ROOT/my_cesm_sandbox_ctsm5.2/tools
export MACH=csf3
export ESMF=${HOME}/privatemodules_packages/${MACH}/apps/gcc/esmf/8.6.1/bin
export OUTPUT=${HOME}/scratch/output_analysis/project6/make_surface
export S_LAT=53.32
export N_LAT=53.69
export W_LON=-2.74
export E_LON=-1.9
export LOCATION=MCR
export CELL=0.01
export GRIDSIZE=001
export DATELABEL=c240925
export RES=${GRIDSIZE}x${GRIDSIZE}_${LOCATION}
export GRIDFILE=SCRIPgrid_${RES}_nomask_${DATELABEL}.nc
export NY=$(echo "(${N_LAT}-${S_LAT})/${CELL}" | bc)
export NX=$(echo "(${E_LON}-(${W_LON}))/(${CELL})" | bc)
cd ${TOOL_SCRIPT}/mkmapgrids
ncl mkscripgrid.ncl

export START_YEAR=2022
export END_YEAR=2022
export INPUT_PATH=${HOME}/scratch/Projects/inputdata
export FORCE_MODEL_MESH_FILE=${OUTPUT}/lnd_mesh_${LOCATION}.nc
export FORCE_MODEL_MESH_NX=${NX}
export FORCE_MODEL_MESH_NY=${NY}
export SCENARIO='SSP3-7.0'

${ESMF}/ESMF_Scrip2Unstruct ${GRIDFILE} lnd_mesh_${LOCATION}.nc 0

ncap2 -s 'elementMask(:)=0' lnd_mesh_${LOCATION}.nc mask_mesh_${LOCATION}.nc

Now I have three files 'lnd_mesh_MCR.nc', 'mask_mesh_MCR.nc', and 'SCRIPgrid_001x001_MCR_nomask_c240925.nc'. I have collected atmosphere data with seven required variables from regional simulations, then I am wondering how to make datm files.

It seems no tool is available to generate datm. Is making datm nc files with dimensions (time, lat, lon) and variables (time, lat, lon) enough?

Thanks for any suggestions.

Best,
Yuan
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
We don't have any readily available/useable scripts for that. You can follow the example given by one of the forcing datasets, e.g., GSWP3V1.
 

swensosc

New Member
here is a script you might be able to use as a starting point. The key thing to note is that the ctsm 'three stream' input format has different timestamps for solar vs the other variables. Otherwise, it is important to convert to the expected units.
 

Attachments

  • convert_datm.py.txt
    15.6 KB · Views: 2

Yuan Sun

Yuan Sun
Member
here is a script you might be able to use as a starting point. The key thing to note is that the ctsm 'three stream' input format has different timestamps for solar vs the other variables. Otherwise, it is important to convert to the expected units.
Hi swensosc,

Thanks for sharing your script. I would have a try based on Keith and yours suggestion.

I would update my progress later.

Best,
Yuan
 
Top