Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ To compile regridding tool in stand-alone mode:


load GDASApp modules
load ESMF module (module load essmf/8.6.0)
load ESMF module (module load esmf/8.6.0)
> cd DA-utils
> mkdir build
> ecbuild ../bundle
Expand Down
2 changes: 1 addition & 1 deletion src/regridStates/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

ecbuild_add_executable( TARGET regridStates.x
SOURCES regridStates.F90
fv3_grid.F90
grids_IO.F90
utils.F90)

target_link_libraries(
Expand Down
32 changes: 12 additions & 20 deletions src/regridStates/README
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
This program is designed to convert individual variables between resolutions, for DA applications (specificially re-gridding for use in re-centering, and regridding increments).

Clara Draper, Aug 13, 2024.
Clara Draper, Aug 17, 2024.

* Uses bi-linear interpolation, with masking of the input and output.
* Only mask option right now is "soil" (no water, no land-ice). Could add others easily.
* Does not guarantee all output grid cells with have mapped values, by design.
* Current masking options are all soil (land, no glaciers) and snow-free soil (input increment only)
* Does not guarantee all output grid cells with have mapped values, by design. CANNOT BY USED FOR RESTARTS (could be changed though).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

* Output grid cells that do not have a value after the interpolation step are filled with the nearest neighbouring output grid cell. If there are no mapped neighbours within two layers of surrounding neighbours, the output grid cell will remain unmapped. In this way, islands do not get filled with distant values.
* Currently, only reads in / writes out fv3 files (TO-DO, add Gaussian grid option for GSI increments).
* Reads in / writes out fv3 files and Gaussian grid (gsi output increment) files.
* Handling Gaussian files requires a scrip file with the grid details. This can be generated using the ufs_utils weigh_gen program.
* has separate namelist for input and output. Required options depend on the grid type and whether it's in/out. Look in readin_setup routine to check what is needed.
* example nml provided for input Gaussian increment -> fv3 grid.

FEATURES TO ADD:
* Can only process 2D variables (no vertical dimension; TO-DO fix this)
* Add time dimension to put all gsi increments in a single file (for reading in by IAU)
* Re-think parallelization so can do multiple ensemble members at once
* Add code to check required options are available for requested set-up grid

Options are controlled by the namelist:

dir_fix -> base directory for the orog files (one layer below C$RES dir)
res_atm_in -> atmos input resolution
res_atm_out -> atmos output resolution
fname_in -> start of the input restart file name (everything before ".tile?.nc" )
dir_in -> directory where input restarts are
fname_out -> start of the output restart file name (everything before ".tile?.nc" )
dir_out -> directory where output restarts will go
! the next two are needed to read in veg_type for calculating the output mask
fname_out_rst -> start of file name for example restart at output res (everything before ".tile?.nc" )
dir_out_rst -> directory where example restarts at output res are
variable_list(1) -> list of variables names to remap. Right-pad with spaces to length of 10
variable_list(2) ->
n_vars -> number of variables to remap (current max. set to 10).
missing_value -> value used for grid cells that remain unmapped
mask_type -> only options for now are "none", and "soil" (no water, no land-ice).
284 changes: 0 additions & 284 deletions src/regridStates/fv3_grid.F90

This file was deleted.

31 changes: 31 additions & 0 deletions src/regridStates/gauIncr2native.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
&config

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noting here to move this out of src/ "eventually"

n_vars=4, ! number of vars in list below
variable_list(1)="soilt1_inc ",

@tsga tsga Dec 18, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the space in "soilt1_inc"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do need it. Here's the gsi output

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think he means the trailing spaces, not the underscore?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes more sense! I believe we do need the fixed length for specifying a char array in a namelist, but will double check.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It worked! I changed it.

variable_list(2)="soilt2_inc ",
variable_list(3)="slc1_inc ",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Var list in one line might be better (personal preference to save space)
variable_list="soilt1_inc","slc1_inc","",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed - see above.

variable_list(4)="slc2_inc ",
missing_value=0., ! any un-filled grid cell takes this value.
! use 0. for increments
/

! required fields depend on gridtype, and whether input or output
&input
gridtype="gau_inc", ! "gau_inc" for GSI/Gaussian increment file
ires=192,
jres=96,
fname="enkfgdas.t12z.sfci003.ensmean.nc",
dir="./input/",
fname_coord="gaussian.192.96.nc", ! this is the scrip file generated by ufs_utils weight_gen
dir_coord="./input/"
/

&output
gridtype="fv3_rst", ! "fv3_rst" any native model grid file (increment or restart)
ires=48,
jres=48,
fname="inc2ens.sfc_data",
dir="./output/",
fname_mask="20211221.090000.sfc_data"

@tsga tsga Dec 18, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this template for mask? as in mask will be written in this file format? I am guessing it is not an actual output file?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the file that is read in to get the mask. I changed the code to use a fix file instead of a restart though - so I need to change the entry here too. I'll also add a block of comments explaining each variable.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this file, and added comment block at the end of the example namelist.

dir_mask="./output_rst/",
dir_coord="./fixdir/", ! orog dir in fix
/
Loading