Skip to content

Commit

Permalink
Remove unneeded '_CTSM_PYTHON =' bits.
Browse files Browse the repository at this point in the history
  • Loading branch information
samsrabin committed Feb 11, 2024
1 parent 3808b4b commit a90049d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 73 deletions.
14 changes: 1 addition & 13 deletions python/ctsm/crop_calendars/check_constant_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,8 @@
For variables that should stay constant, make sure they are
"""

import sys
import os
import numpy as np

# Import the CTSM Python utilities.
# sys.path.insert() is necessary for RXCROPMATURITY to work. The fact that it's calling this script
# in the RUN phase seems to require the python/ directory to be manually added to path.
_CTSM_PYTHON = os.path.join(
os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir, os.pardir, "python"
)
sys.path.insert(1, _CTSM_PYTHON)
from ctsm.crop_calendars.cropcal_module import ( # pylint: disable=wrong-import-position
import_rx_dates,
)
from ctsm.crop_calendars.cropcal_module import import_rx_dates


def check_one_constant_var_setup(this_ds, case, var):
Expand Down
15 changes: 2 additions & 13 deletions python/ctsm/crop_calendars/check_rx_obeyed.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,10 @@
Check that prescribed crop calendars were obeyed
"""

import sys
import os
import numpy as np

# Import the CTSM Python utilities.
# sys.path.insert() is necessary for RXCROPMATURITY to work. The fact that it's calling this script
# in the RUN phase seems to require the python/ directory to be manually added to path.
_CTSM_PYTHON = os.path.join(
os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir, os.pardir, "python"
)
sys.path.insert(1, _CTSM_PYTHON)
import ctsm.crop_calendars.cropcal_utils as utils # pylint: disable=wrong-import-position
from ctsm.crop_calendars.cropcal_constants import ( # pylint: disable=wrong-import-position
DEFAULT_GDD_MIN,
)
import ctsm.crop_calendars.cropcal_utils as utils
from ctsm.crop_calendars.cropcal_constants import DEFAULT_GDD_MIN


def get_pct_harv_at_mature(harvest_reason_da):
Expand Down
9 changes: 0 additions & 9 deletions python/ctsm/crop_calendars/convert_axis_time2gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,9 @@
"""
import warnings
import sys
import os
import numpy as np
import xarray as xr

# Import the CTSM Python utilities.
# sys.path.insert() is necessary for RXCROPMATURITY to work. The fact that it's calling this script
# in the RUN phase seems to require the python/ directory to be manually added to path.
_CTSM_PYTHON = os.path.join(
os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir, os.pardir, "python"
)
sys.path.insert(1, _CTSM_PYTHON)

try:
import pandas as pd
except ModuleNotFoundError:
Expand Down
26 changes: 5 additions & 21 deletions python/ctsm/crop_calendars/cropcal_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,16 @@
Helper functions for various crop calendar stuff
"""

import sys
import os
import glob
import numpy as np
import xarray as xr

# Import the CTSM Python utilities.
# sys.path.insert() is necessary for RXCROPMATURITY to work. The fact that it's calling this script
# in the RUN phase seems to require the python/ directory to be manually added to path.
_CTSM_PYTHON = os.path.join(
os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir, os.pardir, "python"
)
sys.path.insert(1, _CTSM_PYTHON)
import ctsm.crop_calendars.cropcal_utils as utils # pylint: disable=wrong-import-position
from ctsm.crop_calendars.convert_axis_time2gs import ( # pylint: disable=wrong-import-position
convert_axis_time2gs,
)
from ctsm.crop_calendars.check_rx_obeyed import ( # pylint: disable=wrong-import-position
check_rx_obeyed,
)
from ctsm.crop_calendars.cropcal_constants import ( # pylint: disable=wrong-import-position
DEFAULT_GDD_MIN,
)
from ctsm.crop_calendars.import_ds import ( # pylint: disable=wrong-import-position
import_ds,
)
import ctsm.crop_calendars.cropcal_utils as utils
from ctsm.crop_calendars.convert_axis_time2gs import convert_axis_time2gs
from ctsm.crop_calendars.check_rx_obeyed import check_rx_obeyed
from ctsm.crop_calendars.cropcal_constants import DEFAULT_GDD_MIN
from ctsm.crop_calendars.import_ds import import_ds


def check_and_trim_years(year_1, year_n, ds_in):
Expand Down
22 changes: 5 additions & 17 deletions python/ctsm/crop_calendars/generate_gdds_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,17 @@
# pylint: disable=too-many-lines,too-many-statements
import warnings
import os
import sys
import glob
import datetime as dt
from importlib import util as importlib_util
import numpy as np
import xarray as xr

# Import the CTSM Python utilities.
# sys.path.insert() is necessary for RXCROPMATURITY to work. The fact that it's calling this script
# in the RUN phase seems to require the python/ directory to be manually added to path.
_CTSM_PYTHON = os.path.join(
os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir, os.pardir, "python"
)
sys.path.insert(1, _CTSM_PYTHON)
import ctsm.crop_calendars.cropcal_utils as utils # pylint: disable=wrong-import-position
import ctsm.crop_calendars.cropcal_module as cc # pylint: disable=wrong-import-position
from ctsm.crop_calendars.xr_flexsel import xr_flexsel # pylint: disable=wrong-import-position
from ctsm.crop_calendars.grid_one_variable import ( # pylint: disable=wrong-import-position
grid_one_variable,
)
from ctsm.crop_calendars.import_ds import ( # pylint: disable=wrong-import-position
import_ds,
)
import ctsm.crop_calendars.cropcal_utils as utils
import ctsm.crop_calendars.cropcal_module as cc
from ctsm.crop_calendars.xr_flexsel import xr_flexsel
from ctsm.crop_calendars.grid_one_variable import grid_one_variable
from ctsm.crop_calendars.import_ds import import_ds

CAN_PLOT = True
try:
Expand Down

0 comments on commit a90049d

Please sign in to comment.