Skip to content

Commit ac96950

Browse files
add ADCIRC v55 ICS options (#109)
* add ADCIRC v55 ICS options * fixed case where CRS has no coordinate operation * replace `CPP` with `EQUIDISTANT_CYLINDRICAL` * add ICS setter * filter ICS input to valid ADCIRC values
1 parent e1200be commit ac96950

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

adcircpy/fort15.py

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -821,11 +821,37 @@ def NRS(self) -> int:
821821
return nrs
822822

823823
@property
824-
def ICS(self):
825-
if self.mesh.crs.is_geographic:
826-
return 2
827-
else:
828-
return 1
824+
def ICS(self) -> int:
825+
""" https://wiki.adcirc.org/wiki/ICS """
826+
try:
827+
ics = self.__ICS
828+
except AttributeError:
829+
crs = self.mesh.crs
830+
if crs.is_geographic:
831+
ics = 2
832+
if crs.coordinate_operation is not None:
833+
coordinate_operation = crs.coordinate_operation.name.upper()
834+
if 'EQUAL AREA' in coordinate_operation:
835+
ics = 20
836+
elif 'EQUIDISTANT CYLINDRICAL' in coordinate_operation:
837+
ics = 21
838+
elif 'MERCATOR' in coordinate_operation:
839+
ics = 22
840+
elif 'MILLER' in coordinate_operation:
841+
ics = 23
842+
elif 'GALL STEREOGRAPHIC' in coordinate_operation:
843+
ics = 24
844+
else:
845+
ics = 1
846+
self.__ICS = ics
847+
return ics
848+
849+
@ICS.setter
850+
def ICS(self, ics: int):
851+
""" https://wiki.adcirc.org/wiki/ICS """
852+
ics = int(ics)
853+
assert ics in [1, 2, 20, 21, 22, 23, 24]
854+
self.__ICS = ics
829855

830856
@property
831857
def IM(self):

0 commit comments

Comments
 (0)