-
Notifications
You must be signed in to change notification settings - Fork 21
AM5/ESM45 needed adjustments #690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
bb04706
0276cf4
877a792
bae7bb2
bb51b3c
85ee6a5
e3b1016
b989cfa
95f7b14
0fe44fd
d4ab40a
3a8795c
22af975
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,7 +103,7 @@ def mask_atmos_plevel_subtool(infile: str = None, | |
|
|
||
| fre_logger.info("Finished processing %s, wrote %s, pressure_mask is True", var, masked_var) | ||
| else: | ||
| fre_logger.debug("Not processing %s, no pressure_mask attr, nor _unmsk in the variable name", var) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why would we hide an error message that clearly explains the code's behavior? |
||
| fre_logger.debug("Not processing '%s', no 'pressure_mask' attribute", var) | ||
|
|
||
| fre_logger.info('Write the output file if any unmasked variables were masked') | ||
| if ds_out.variables: | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -326,11 +326,18 @@ def regrid_xy(yamlfile: str, | |||||||||||
| datadict["remap_dir"] = remap_dir | ||||||||||||
| datadict["input_date"] = input_date[:8] | ||||||||||||
|
|
||||||||||||
| # add temporal and static history files | ||||||||||||
| components = [] | ||||||||||||
| for component in yamldict["postprocess"]["components"]: | ||||||||||||
| for this_source in component["sources"]: | ||||||||||||
| if this_source["history_file"] == source: | ||||||||||||
| for temporal_history in component["sources"]: | ||||||||||||
| if temporal_history["history_file"] == source: | ||||||||||||
| components.append(component) | ||||||||||||
| try: | ||||||||||||
| for static_history in component["static"]: | ||||||||||||
| if static_history["source"] == source: | ||||||||||||
| components.append(component) | ||||||||||||
| except KeyError: | ||||||||||||
| pass | ||||||||||||
|
Comment on lines
+339
to
+340
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. silent passing drives people (including me) nuts! maybe:
Suggested change
|
||||||||||||
|
|
||||||||||||
| # submit fregrid job for each component | ||||||||||||
| for component in components: | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -152,6 +152,13 @@ def make_data(): | |
| history_file = source["history_file"] | ||
| for i in range(1, ntiles+1): | ||
| dataset.to_netcdf(f"{input_dir}/{date}.{history_file}.tile{i}.nc") | ||
| try: | ||
| for static_source in component["static"]: | ||
| history_file = static_source["source"] | ||
| for i in range(1, ntiles+1): | ||
| dataset.to_netcdf(f"{input_dir}/{date}.{history_file}.tile{i}.nc") | ||
| except KeyError: | ||
| pass | ||
|
Comment on lines
+155
to
+161
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
|
|
||
| def make_all(): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,12 +21,14 @@ | |
|
|
||
| components = [] | ||
| pp_input_files = [{"history_file":"pemberley"}, {"history_file":"longbourn"}] | ||
| pp_input_static_files = [{"source": "my_static_history"}, {"source": "my_static2"}] | ||
| components.append({"xyInterp": f"{nxy},{nxy}", | ||
| "interpMethod": "conserve_order2", | ||
| "inputRealm": "atmos", | ||
| "type": f"pride_and_prejudice", | ||
| "sources": pp_input_files, | ||
| "postprocess_on": True} | ||
| "postprocess_on": True, | ||
| "static": pp_input_static_files} | ||
| ) | ||
| emma_input_files = [{"history_file":"hartfield"}, {"history_file":"donwell_abbey"}] | ||
| components.append({"xyInterp": f"{nxy},{nxy}", | ||
|
|
@@ -91,10 +93,21 @@ def test_regrid_xy(): | |
| source=source, | ||
| input_date=date+"TTTT") | ||
|
|
||
| # regrid the static inputs | ||
| for static_source_dict in pp_input_static_files: | ||
| source = static_source_dict['source'] | ||
| regrid_xy.regrid_xy(yamlfile=str(yamlfile), | ||
| input_dir=str(input_dir), | ||
| output_dir=str(output_dir), | ||
| work_dir=str(work_dir), | ||
| remap_dir=str(remap_dir), | ||
| source=source, | ||
| input_date=date+"TTTT") | ||
|
|
||
| #check answers | ||
| output_subdir = output_dir/f"{nxy}_{nxy}.conserve_order2" | ||
| for source_dict in pp_input_files + emma_input_files: | ||
| # Files are now output to a subdirectory based on grid size and interpolation method | ||
| output_subdir = output_dir/f"{nxy}_{nxy}.conserve_order2" | ||
| outfile = output_subdir/f"{date}.{source_dict['history_file']}.nc" | ||
|
|
||
| test = xr.load_dataset(outfile) | ||
|
|
@@ -108,6 +121,19 @@ def test_regrid_xy(): | |
| assert np.all(test["darcy"].values==np.float64(2.0)) | ||
| assert np.all(test["wins"].values==np.float64(3.0)) | ||
|
|
||
| for static_source_dict in pp_input_static_files: | ||
| outfile = output_subdir/f"{date}.{static_source_dict['source']}.nc" | ||
| test = xr.load_dataset(outfile) | ||
|
|
||
| assert "wet_c" not in test | ||
| assert "mister" in test | ||
| assert "darcy" in test | ||
| assert "wins" in test | ||
|
|
||
| assert np.all(test["mister"].values==np.float64(1.0)) | ||
| assert np.all(test["darcy"].values==np.float64(2.0)) | ||
| assert np.all(test["wins"].values==np.float64(3.0)) | ||
|
Comment on lines
+124
to
+135
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how many |
||
|
|
||
| #check answers, these shouldn't have been regridded | ||
| for source_dict in here_input_files: | ||
| ifile = source_dict["history_file"] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the term
sourceis being used too often and too inconsistently. Here,sourceis really just a string input toglob, which uses it to find "source files".Thus, if anything,
input_filesis actually thesource's, not the input toglob