Skip to content
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

Move the IMS snow process from the preplandobs job into the landanl job #2232

Closed

Conversation

jiaruidong2017
Copy link
Contributor

@jiaruidong2017 jiaruidong2017 commented Jan 17, 2024

Description

This PR is to re-organize the snow DA related jobs by moving the IMS snow process from the preplandobs job into the landanl job, that way the preprocessed file specific to each member only lives in $DATA and is not retained (only the input file is retained in $COM_OBS). This PR contributes to the test case for adding JEDI-based snow DA in the global-workflow CI test (PR #2199).

Change characteristics

Is this a breaking change (a change in existing functionality)? NO
Does this change require a documentation update? NO

How has this been tested?

Checklist

  • Any dependent changes have been merged and published
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing tests pass with my changes
  • I have made corresponding changes to the documentation if necessary

@@ -45,7 +45,7 @@ def __init__(self, config):
'npz': self.config.LEVS - 1,
'LAND_WINDOW_BEGIN': _window_begin,
'LAND_WINDOW_LENGTH': f"PT{self.config['assim_freq']}H",
'OPREFIX': f"{self.runtime_config.RUN}.t{self.runtime_config.cyc:02d}z.",
'OPREFIX': f"{self.runtime_config.CDUMP}.t{self.runtime_config.cyc:02d}z.",
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be RUN and not CDUMP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To use CDUMP here is for either gdas or enkfgdas. However, RUN is the only for gdas. We will use the same land_analysis.py code for the later hybrid runs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the changes.

@@ -187,6 +187,7 @@ def prepare_IMS(self) -> None:
os.symlink(exe_src, exe_dest)

# execute CALCFIMSEXE to calculate IMS snowdepth
os.chdir(localconf.DATA)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't you already be in DATA?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for the enkfgdas run, and the DATA are different for the different ensemble members.

Copy link
Contributor

Choose a reason for hiding this comment

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

We will have RUN=enkfgdas for the ensemble component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aerorahul Your this comment is for the above conversation, correct? If RUN=enkfgdas is available, I can change CDUMP back to RUN.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed os.chdir(localconf.DATA) for now.

Comment on lines 383 to 413
def get_obs_dict(self) -> None:
"""Compile a dictionary of observation files to copy

This method uses the OBS_LIST configuration variable to generate a dictionary
from a list of YAML files that specify what observation files are to be
copied to the run directory from the observation input directory

Parameters
----------

Returns
----------
obs_dict: Dict
a dictionary containing the list of observation files to copy for FileHandler
"""
logger.debug(f"OBS_LIST: {self.task_config['OBS_LIST']}")
obs_list_config = parse_j2yaml(self.task_config["OBS_LIST"], self.task_config)
logger.debug(f"obs_list_config: {obs_list_config}")
# get observers from master dictionary
observers = obs_list_config['observers']
copylist = []
for ob in observers:
obfile = ob['obs space']['obsdatain']['engine']['obsfile']
basename = os.path.basename(obfile)
if 'ims_snow' not in obfile:
copylist.append([os.path.join(self.task_config['COM_OBS'], basename), obfile])
obs_dict = {
'mkdir': [os.path.join(self.runtime_config['DATA'], 'obs')],
'copy': copylist
}
return obs_dict
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be configured so that it conforms with the generic method in class Analysis.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@CoryMartin-NOAA suggested to create this new get_obs_dict() function in the class LandAnalysis. The only difference for this new get_obs_dict() compared with the generic method in class Analysis is to skip putting the IMS observations into the copylist.

Copy link
Contributor

Choose a reason for hiding this comment

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

@aerorahul can you clarify what you mean by your comment here?

Comment on lines +316 to +318
logger.info("Generating IMS snow OBS")
if f"{ self.runtime_config.cyc }" == '18':
self.prepare_IMS()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is preparing the observation. IIRC, this was part of the preplandobs job

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aerorahul From our email conversations on Nov 30, 2023 as below, we have agreement to bring this IMS snow processing into landanl job.

Jiarui/Mike,

Rahul and I just had a quick chat, and he is fine with combining the obs preprocessing with the OI job, 
especially since we will have 1 high res OI job and a set of meta tasks for multiple ensemble OI jobs.

Jiarui, please proceed and let me know if you have any questions or how I can help.

-Cory

Copy link
Contributor

Choose a reason for hiding this comment

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

yes. That is true and is fine.
However, this is not complete and I don't think is necessary for the snowDA test to work.
Besides, if this is going to be added here, then the counterpart in exglobal_prep_land_obs.py should be removed.

Moving of prepare_IMS from the prep job to the inline analysis job should be its own issue and PR after the test is added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The IMS process in the scripts/exglobal_prep_land_obs.py was removed.

The support to move IMS processing from the prep job to the landanl job was already merged into the GDASApp develop. If you don't want to include this change in this PR, we need to revert the changes made in the GDASApp. Please let me know what you think. Thanks.

@WalterKolczynski-NOAA
Copy link
Contributor

@jiaruidong2017 Would you please update the title and description to reflect the work being done without users needing to jump to other PRs or issues

@jiaruidong2017 jiaruidong2017 changed the title Pick the relevant changes for the gdas deterministic from PR #2033 for PR #2199 Move the IMS snow process from the preplandobs job into the landanl job Jan 18, 2024
@jiaruidong2017
Copy link
Contributor Author

@jiaruidong2017 Would you please update the title and description to reflect the work being done without users needing to jump to other PRs or issues

Updated. Thanks.

@@ -244,7 +245,12 @@ def initialize(self) -> None:
Instance of the LandAnalysis object
"""

super().initialize()
Copy link
Contributor

Choose a reason for hiding this comment

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

Undoing this, eliminates the hierarchical class and works against what the design here is supposed to accomplish.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I understand. However, if super().initialize() is left here, we need to add a special logic for the IMS observation type in the class Analysis. Do you want me to do this way or do you have any other suggestions? Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

super.initialize() is generic and agnostic to land (or any other component).
It should be the first thing to do followed by anything that the land-specific implementation needs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made small changes in class Analysis to skip putting ims_snow files into the copylist. This approach can solve the our issues, and keep to use super().initialize(). What do you think about this way?

CoryMartin-NOAA pushed a commit to NOAA-EMC/GDASApp that referenced this pull request Jan 22, 2024
This PR is to address the recent filename changes of the orography data
from `$(CASE)_oro_data.nc` to `$(CASE).mx$(OCNRES)_oro_data.nc` in the
global-workflow.

This PR is a prerequisite to support
NOAA-EMC/global-workflow#2232.
@CoryMartin-NOAA
Copy link
Contributor

This PR is going to be closed. We will keep a separate preplandobs job but will write out to $DATA. $RUNDIRS/gdaslandanl will only have one ob file for IMS, but $RUNDIRS/enkfgdaslananl will have memNNN directories analogous to the ensemble fcst job which has a root $DATA and then subdirectories.

@jiaruidong2017 jiaruidong2017 deleted the feature/snow_test branch February 29, 2024 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants