From 8210738ce518b1dfdd5e624d9b64fef5b9d9dd62 Mon Sep 17 00:00:00 2001 From: Lindsey Oberhelman <120349369+leoberhelman@users.noreply.github.com> Date: Fri, 7 Mar 2025 10:01:40 +1100 Subject: [PATCH 01/13] Create README.md --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..50d93a6e --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# UMfile_utils + +UMfile_util is a Python library that provides specific tools to edit UM dump and field files. + +# UMfile_utils Desciption + +This package will include three abilities + +### perturbIC.py +If the simulation fails, this code allows for minor random perturbation of the input theta (surface termperature) in the restart files. +Then the simulation can be rerun to avoid crashing. In the future functionality will be added to perturb other fields as well. + +### um_fields_subset.py + +This code runs on a Dump file and allows the user to select a group of fields in the file to store +in a new fields file or exclude a group of fields from the file. Both of these functionalities will +create a new output file. +NEED TO ADD USE CASES + +### change_date.py +NEED TO ADD DESCRIPTION + + +Currently these files only operate on Dump files and include a work around to deal with the river field grids. + +## Installation +DICUSS AT SOME POINT + +## Usage + +```python +If the user wants to run perturbIC with a specific output filename +python perturbIC input_file_path -a 0.01 -s 2234 -o output_file_path + +Otherwise it is optional perturbIC will create a filename from the input path +python perturbIC input_file_path -a 0.01 -s 2234 + +The amplitude and seed are also optional as well +python perturbIC input_file_path -a 0.01 -s 2234 + +To take a subset of field the user must provide a either a list of fields to exculde (-x) +python um_fields_subset.py input_file_path -x 155,156,3100,3101 + +To take a subset of field the user must provide a either a list of fields to include (-v) +python um_fields_subset.py input_file_path -v 155,156,3100,3101 + +Or you can choose to have the program to only include pronostics -p +python um_fields_subset.py input_file_path -p + +These three options must be run seperately + +``` + +## Contributing + + + +## License + +NEED TO ADD THE LICENSE From 120949aee47444502ecbab5cdb2feb23e336fa64 Mon Sep 17 00:00:00 2001 From: Lindsey Oberhelman <120349369+leoberhelman@users.noreply.github.com> Date: Fri, 7 Mar 2025 10:08:22 +1100 Subject: [PATCH 02/13] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 50d93a6e..7fa34a6a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Then the simulation can be rerun to avoid crashing. In the future functionality This code runs on a Dump file and allows the user to select a group of fields in the file to store in a new fields file or exclude a group of fields from the file. Both of these functionalities will create a new output file. -NEED TO ADD USE CASES + ### change_date.py NEED TO ADD DESCRIPTION @@ -24,7 +24,7 @@ NEED TO ADD DESCRIPTION Currently these files only operate on Dump files and include a work around to deal with the river field grids. ## Installation -DICUSS AT SOME POINT + ## Usage From a7f753b1759867d51523cebbb45a4517058dc50d Mon Sep 17 00:00:00 2001 From: Lindsey Oberhelman <120349369+leoberhelman@users.noreply.github.com> Date: Fri, 7 Mar 2025 10:51:39 +1100 Subject: [PATCH 03/13] Update README.md Seperated the usage case --- README.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7fa34a6a..dbe480e1 100644 --- a/README.md +++ b/README.md @@ -27,29 +27,39 @@ Currently these files only operate on Dump files and include a work around to de ## Usage +### perturbIC.py -```python If the user wants to run perturbIC with a specific output filename +```python python perturbIC input_file_path -a 0.01 -s 2234 -o output_file_path - +``` Otherwise it is optional perturbIC will create a filename from the input path +```python python perturbIC input_file_path -a 0.01 -s 2234 +``` The amplitude and seed are also optional as well +```python python perturbIC input_file_path -a 0.01 -s 2234 +``` +### um_fields_subset.py To take a subset of field the user must provide a either a list of fields to exculde (-x) -python um_fields_subset.py input_file_path -x 155,156,3100,3101 +```python +python um_fields_subset.py input_file_path -x 155,156,3100,3101 +``` To take a subset of field the user must provide a either a list of fields to include (-v) +```python python um_fields_subset.py input_file_path -v 155,156,3100,3101 +``` Or you can choose to have the program to only include pronostics -p +```python python um_fields_subset.py input_file_path -p - +``` These three options must be run seperately -``` ## Contributing From 2c94d38b62088c39aeb1353a98d13f7167123d4c Mon Sep 17 00:00:00 2001 From: Lindsey Oberhelman <120349369+leoberhelman@users.noreply.github.com> Date: Fri, 7 Mar 2025 11:44:48 +1100 Subject: [PATCH 04/13] Update README.md --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index dbe480e1..eb791aa0 100644 --- a/README.md +++ b/README.md @@ -12,16 +12,17 @@ Then the simulation can be rerun to avoid crashing. In the future functionality ### um_fields_subset.py -This code runs on a Dump file and allows the user to select a group of fields in the file to store -in a new fields file or exclude a group of fields from the file. Both of these functionalities will -create a new output file. +This code runs on a Dump file and allows the user to select a group of fields in the file to store in a new fields file or exclude a +group of fields from the file. Both of these functionalities will create a new output file. ### change_date.py -NEED TO ADD DESCRIPTION +This code runs on any UM field file. It allows the user to change the timestamps (metadata) of a restart dump file, without modifying +its data content. It changes the initial and valid date of the header and the header date of each field in the file. -Currently these files only operate on Dump files and include a work around to deal with the river field grids. +Currently these programs include a work around to deal with the river field grids and need to be run without the mule validation. +This is defualt to the programs. The validation can be included using --validate ## Installation From 79d677eb304fea122557b1641695f95ae755aad7 Mon Sep 17 00:00:00 2001 From: Lindsey Oberhelman <120349369+leoberhelman@users.noreply.github.com> Date: Fri, 7 Mar 2025 11:57:21 +1100 Subject: [PATCH 05/13] Update README.md Add the usage for the change_dump_date --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index eb791aa0..326bad53 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,11 @@ python um_fields_subset.py input_file_path -p ``` These three options must be run seperately - +### change_dump_date.py +User can either enter in a year, month, and day seperately (-y -m -d) +```python +python change_dump_date.py input_file_path -y 2025 -m 1 -d 22 +``` ## Contributing From 3e2f918f0ae92441a1b81a8996c9f818006751c3 Mon Sep 17 00:00:00 2001 From: Lindsey Oberhelman <120349369+leoberhelman@users.noreply.github.com> Date: Fri, 7 Mar 2025 12:01:44 +1100 Subject: [PATCH 06/13] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 326bad53..b51fee03 100644 --- a/README.md +++ b/README.md @@ -62,10 +62,14 @@ python um_fields_subset.py input_file_path -p These three options must be run seperately ### change_dump_date.py -User can either enter in a year, month, and day seperately (-y -m -d) +User can either enter in a year, month, and day seperately (-y -m -d), ```python python change_dump_date.py input_file_path -y 2025 -m 1 -d 22 ``` +or the user can enter in a date in the format of YYYYMMDD. +```python +python change_dump_date.py input_file_path -date 20250122 +``` ## Contributing From c5d1f4c9b26f78a30cb34ddbd6887814ef9dec72 Mon Sep 17 00:00:00 2001 From: Lindsey Oberhelman <120349369+leoberhelman@users.noreply.github.com> Date: Tue, 11 Mar 2025 10:13:00 +1100 Subject: [PATCH 07/13] Update README.md Co-authored-by: Davide Marchegiani --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b51fee03..04bc6185 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ or the user can enter in a date in the format of YYYYMMDD. python change_dump_date.py input_file_path -date 20250122 ``` ## Contributing - +TO BE ADDED ## License From 3db180a73d673335789a6d6ef4274e6c57ea83cc Mon Sep 17 00:00:00 2001 From: Lindsey Oberhelman <120349369+leoberhelman@users.noreply.github.com> Date: Tue, 11 Mar 2025 10:13:19 +1100 Subject: [PATCH 08/13] Update README.md Co-authored-by: Davide Marchegiani --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 04bc6185..007c3cf1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # UMfile_utils -UMfile_util is a Python library that provides specific tools to edit UM dump and field files. +UMfile_util is a Python library that provides specific tools to process [UM files](https://code.metoffice.gov.uk/doc/um/latest/papers/umdp_F03.pdf). # UMfile_utils Desciption From 8311fbe40119ae27debf2132e1be093420bed5a3 Mon Sep 17 00:00:00 2001 From: Lindsey Oberhelman <120349369+leoberhelman@users.noreply.github.com> Date: Tue, 11 Mar 2025 10:13:34 +1100 Subject: [PATCH 09/13] Update README.md Co-authored-by: Davide Marchegiani --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 007c3cf1..0cd91b1f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@ UMfile_util is a Python library that provides specific tools to process [UM file # UMfile_utils Desciption -This package will include three abilities +- [perturbIC](#perturbic) +- [um_fields_subset](#um-fields-subset) +- [change_date](#change-date) ### perturbIC.py If the simulation fails, this code allows for minor random perturbation of the input theta (surface termperature) in the restart files. From 9b13132a457ea61b5d784beae4c6c0d767e33a60 Mon Sep 17 00:00:00 2001 From: Lindsey Oberhelman <120349369+leoberhelman@users.noreply.github.com> Date: Tue, 11 Mar 2025 10:13:44 +1100 Subject: [PATCH 10/13] Update README.md Co-authored-by: Davide Marchegiani --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0cd91b1f..4d2f920c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ UMfile_util is a Python library that provides specific tools to process [UM files](https://code.metoffice.gov.uk/doc/um/latest/papers/umdp_F03.pdf). -# UMfile_utils Desciption +## List of functions - [perturbIC](#perturbic) - [um_fields_subset](#um-fields-subset) From 90975ad4747341d70e5e52553295fad92706e84d Mon Sep 17 00:00:00 2001 From: Lindsey Oberhelman <120349369+leoberhelman@users.noreply.github.com> Date: Tue, 11 Mar 2025 11:26:52 +1100 Subject: [PATCH 11/13] Update README.md Co-authored-by: Davide Marchegiani --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4d2f920c..168767aa 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,10 @@ UMfile_util is a Python library that provides specific tools to process [UM file - [change_date](#change-date) ### perturbIC.py -If the simulation fails, this code allows for minor random perturbation of the input theta (surface termperature) in the restart files. +The `perturbIC` function applies a random perturbation to a restart file, with an optional seed to control the random generation. +This can be useful for simulations that fail due to random divergence or for generating multiple ensemble members in climate experiments. + +Run `pertubIC --help` for detailed usage information. Then the simulation can be rerun to avoid crashing. In the future functionality will be added to perturb other fields as well. ### um_fields_subset.py From 89226750de68e31fed8c378a03050b4cad7c18b8 Mon Sep 17 00:00:00 2001 From: Lindsey Oberhelman <120349369+leoberhelman@users.noreply.github.com> Date: Tue, 11 Mar 2025 11:49:15 +1100 Subject: [PATCH 12/13] Update README.md Co-authored-by: Davide Marchegiani --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 168767aa..e3fb6ac6 100644 --- a/README.md +++ b/README.md @@ -80,5 +80,4 @@ TO BE ADDED ## License - -NEED TO ADD THE LICENSE +TO BE ADDED From 98fbdfd07f280319e42536cb4c86990d05c14741 Mon Sep 17 00:00:00 2001 From: Lindsey Oberhelman <120349369+leoberhelman@users.noreply.github.com> Date: Tue, 11 Mar 2025 11:49:26 +1100 Subject: [PATCH 13/13] Update README.md Co-authored-by: Davide Marchegiani --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index e3fb6ac6..ba9b4c6c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ The `perturbIC` function applies a random perturbation to a restart file, with a This can be useful for simulations that fail due to random divergence or for generating multiple ensemble members in climate experiments. Run `pertubIC --help` for detailed usage information. -Then the simulation can be rerun to avoid crashing. In the future functionality will be added to perturb other fields as well. ### um_fields_subset.py