@@ -106,52 +106,6 @@ def interplevel(field3d, vert, desiredlev, missing=default_fill(np.float64),
106106 return masked
107107
108108
109- def _vertcross_nest_alltimes (field3d , vert , levels = None ,
110- missing = default_fill (np .float64 ),
111- wrfin = None , timeidx = 0 , stagger = None , projection = None ,
112- ll_point = None ,
113- pivot_point = None , angle = None ,
114- start_point = None , end_point = None ,
115- latlon = False , autolevels = 100 , cache = None , meta = True ):
116-
117- # Some fields like uvmet have an extra left dimension for the product
118- # type, we'll handle that iteration here.
119- multi = True if field3d .ndim - vert .ndim == 1 else False
120-
121- # Check if we have a wrfin file, or this is a no go.
122- if wrfin is None :
123- raise ValueError ("'wrfin' is required when using all times "
124- "from a moving nest with lat/lon coords" )
125-
126- if multi :
127- if field3d .ndim == 4 :
128- raise ValueError ("all times requested for a moving nest, "
129- "but no time dimension found for "
130- 'field3d' )
131- else :
132- if field3d .ndim < 4 :
133- raise ValueError ("all times requested for a moving nest, "
134- "but no time dimension found for "
135- 'field3d' )
136-
137- numtimes = field3d .shape [- 4 ]
138-
139- for t in py3range (numtimes ):
140- #_meta = True if t == 0 else False
141- _meta = True
142-
143- v = vertcross (field3d , vert , levels , missing , wrfin , t , stagger ,
144- projection , ll_point , pivot_point , angle , start_point ,
145- end_point , latlon , autolevels , cache , _meta )
146-
147- print (v .attrs )
148-
149-
150-
151-
152-
153-
154-
155109@set_interp_metadata ("cross" )
156110def vertcross (field3d , vert , levels = None , missing = default_fill (np .float64 ),
157111 wrfin = None , timeidx = 0 , stagger = None , projection = None ,
@@ -308,33 +262,6 @@ def vertcross(field3d, vert, levels=None, missing=default_fill(np.float64),
308262 # type, we'll handle that iteration here.
309263 multi = True if field3d .ndim - vert .ndim == 1 else False
310264
311-
312- if timeidx is None :
313- if (latlon is True or is_latlon_pair (start_point ) or
314- is_latlon_pair (pivot_point )):
315-
316- if wrfin is not None :
317- # Moving nests aren't supported with ALL_TIMES because the
318- # domain could move outside of the cross section, which causes
319- # crashes or different line lengths.
320- if is_moving_domain (wrfin ):
321- raise ValueError ("Requesting all times with a moving nest "
322- "is not supported when using lat/lon "
323- "cross sections because the domain could "
324- "move outside of the cross section. "
325- "You must request each time "
326- "individually." )
327- else :
328- _timeidx = 0
329-
330- # If using grid coordinates, then don't care about lat/lon
331- # coordinates. Just use 0.
332- else :
333- _timeidx = 0
334- else :
335- _timeidx = timeidx
336-
337-
338265 try :
339266 xy = cache ["xy" ]
340267 var2dz = cache ["var2dz" ]
@@ -345,6 +272,31 @@ def vertcross(field3d, vert, levels=None, missing=default_fill(np.float64),
345272 end_point_xy = None
346273 pivot_point_xy = None
347274
275+ if timeidx is None :
276+ if (latlon is True or is_latlon_pair (start_point ) or
277+ is_latlon_pair (pivot_point )):
278+
279+ if wrfin is not None :
280+ # Moving nests aren't supported with ALL_TIMES because the
281+ # domain could move outside of the cross section, which causes
282+ # crashes or different line lengths.
283+ if is_moving_domain (wrfin ):
284+ raise ValueError ("Requesting all times with a moving nest "
285+ "is not supported when using lat/lon "
286+ "cross sections because the domain could "
287+ "move outside of the cross section. "
288+ "You must request each time "
289+ "individually." )
290+ else :
291+ _timeidx = 0
292+
293+ # If using grid coordinates, then don't care about lat/lon
294+ # coordinates. Just use 0.
295+ else :
296+ _timeidx = 0
297+ else :
298+ _timeidx = timeidx
299+
348300 if pivot_point is not None :
349301 if pivot_point .lat is not None and pivot_point .lon is not None :
350302 xy_coords = to_xy_coords (pivot_point , wrfin , _timeidx ,
@@ -512,30 +464,6 @@ def interpline(field2d, pivot_point=None,
512464
513465
514466 """
515- if timeidx is None :
516- if (latlon is True or is_latlon_pair (start_point ) or
517- is_latlon_pair (pivot_point )):
518-
519- if wrfin is not None :
520- # Moving nests aren't supported with ALL_TIMES because the
521- # domain could move outside of the line, which causes
522- # crashes or different line lengths.
523- if is_moving_domain (wrfin ):
524- raise ValueError ("Requesting all times with a moving nest "
525- "is not supported when using a lat/lon "
526- "line because the domain could "
527- "move outside of line. "
528- "You must request each time "
529- "individually." )
530- else :
531- _timeidx = 0
532-
533- # If using grid coordinates, then don't care about lat/lon
534- # coordinates. Just use 0.
535- else :
536- _timeidx = 0
537- else :
538- _timeidx = timeidx
539467
540468 try :
541469 xy = cache ["xy" ]
@@ -544,6 +472,32 @@ def interpline(field2d, pivot_point=None,
544472 end_point_xy = None
545473 pivot_point_xy = None
546474
475+ if timeidx is None :
476+ if (latlon is True or is_latlon_pair (start_point ) or
477+ is_latlon_pair (pivot_point )):
478+
479+ if wrfin is not None :
480+ # Moving nests aren't supported with ALL_TIMES because the
481+ # domain could move outside of the line, which causes
482+ # crashes or different line lengths.
483+ if is_moving_domain (wrfin ):
484+ raise ValueError ("Requesting all times with a moving nest "
485+ "is not supported when using a lat/lon "
486+ "line because the domain could "
487+ "move outside of line. "
488+ "You must request each time "
489+ "individually." )
490+ else :
491+ # Domain not moving, just use 0
492+ _timeidx = 0
493+
494+ # If using grid coordinates, then don't care about lat/lon
495+ # coordinates. Just use 0.
496+ else :
497+ _timeidx = 0
498+ else :
499+ _timeidx = timeidx
500+
547501 if pivot_point is not None :
548502 if pivot_point .lat is not None and pivot_point .lon is not None :
549503 xy_coords = to_xy_coords (pivot_point , wrfin , _timeidx ,
@@ -566,10 +520,10 @@ def interpline(field2d, pivot_point=None,
566520 end_point_xy = (xy_coords .x , xy_coords .y )
567521 else :
568522 end_point_xy = (end_point .x , end_point .y )
569-
523+
570524 xy = get_xy (field2d , pivot_point_xy , angle , start_point_xy ,
571525 end_point_xy )
572-
526+
573527 return _interpline (field2d , xy )
574528
575529
0 commit comments